Dynamic Dynamic WordPress Sidebars - wordpress

It's always a drag trying to make sidebars the same height as the page content - too short and your page gets boring at the bottom, too long and your page looks like a run-on sentence.
Is there any way to add/remove/display widgets based on content length, so that the sidebar will only display another widget if there's a ton of sidebar whitespace available?
I'm aware of the overflow CSS property, and would rather try to find a different method :)

I agree that it would be better to avoid this altogether. Users are used to a constant sidebar size, with some pages shorter than the sidebar and some longer than the sidebar.
However, that doesn't actually answer your question. It is theoretically possible to determine the length of the post and make some judgements on which widgets to include based on that; however, it's beyond my skill.
As a halfway solution, you can use a widget that gives you more control over the sidebars. I prefer http://wordpress.org/extend/plugins/conditional-widgets/ but I think http://wordpress.org/extend/plugins/widget-wrangler/ would work well too. With those you could specify which widgets appear on which pages. If you have hundreds of posts of different lengths this may not be suitable, but if you have a handful of pages you could use this to add more widgets to specific pages and have fewer widgets on pages you know are shorter.
Hope this helps!

here is an interesting post about a dynamic sidebar depending on length of page. Does this help?

Related

Propagating a custom block to child pages

So I have a custom block that displays a banner image on top of a parent page. I want the custom block to be automatically copied to all the child pages. Which means the child pages will also have the same banner image as the parent.
I have searched around the internet on how to do this but I have not found any solution. I only found plugins that allows me to display the child pages but that is not what I need.
Does anyone have experience in doing this? Or can anybody point me to the right direction to start with. I'm really feeling hopeless at the moment. Is this possible with gutenberg?
As far as I'm aware, there's no native way to accomplish this.
I normally create a template page with all of the blocks I expect to use and duplicate that as needed.
Depending on your implementation, I'd recommend looking at this page for block templates and see what applies. This article has more details on how to use block templates.

2sxc structured content control previews

I'm looking to find a way to show an image in some various 2sxc drop-down controls. The image would help visualize some style guides. The most obvious example would be where we have a drop-down that gives the user the ability to select a few different heading styles. Variances in heading styles are often much more complex than h1,h2,h3,h4 (also some projects could have upwards of 15 heading styles) and if we could give the end-user a visual representation of how each drop-down might alter the view, I think this would go a long ways to help end users managing content.
This gets a little complex because while something like content types and views already have an image thumbnail, in a more dynamic content type with more flexible data entities, the end result could vary significantly.
I think drop-downs are the most common use case for a image representation because drop-downs or bools often have the largest change in final view code.
I don't think there is currently a way to do something like that unless you want to build your own custom input controls (which I do think is possible). A useful alternative is the Notes field for your Content-Type field. This is WYSIWYG and as of v10+, is also visible in the content editor's UI. So you can include a separate reference page link right there. We do this all the time lately. For example, we often use Bootstrap Buttons and Alerts and most sites have these in customized colors, so we include a link to a page (opens in new window/tab) that shows them what the various choices will look like.
Note that in 2sxc 9 and 10 you can create custom input types. It's fairly difficult in V9 and V10 will have a different API (because it's using WebComponents now). It's still not final and not documented, but that would be an option. If it's really urgent you can contact us through 2sxc.org

Drupal 7 - method or correct procedure for globally updating content types - Advice/Suggestions needed

(I added this on the Drupal support forum also, hope that's ok :) Just hoping to get plenty off feedback)
I am not long after finishing my first major Drupal 7 build, which was really enjoyable but I would admit a rather large learning curve, which after over a year of development, I would admit I still don't know the full power and capacity of Drupal.
My build started off with building our own sub theme, and using that to overwrite all the core theme styles and tailor it to our needs.
Next, I will explain the structure our build. I was tasked with approx 20 different page styles, so in turn I developed 20 content types(templates) for each of these different styles, from here I then added a number of key fields to each content type and then inputted my code into these fields within each content type. e.g. A page with a banner region, a slider region below and a content region below that, for this example say they are all 960px the width of our sites body. So this content type would be made up of three fields, with the the div's and content added to each.
The node developer process would be, if the user wanted that above e.g. style of page, they would select that content type, and simply edit the demo content with the new nodes needed content and set live. So this is the process of the site for developing pages, which has not hit a wall, sadly for me.
So my question is, would it be possible to have say a content type (Or suggest a better approach) which we could globally switch around the layout/styles which then would filter down to all the children nodes? or be able to assign nodes to different content types or anything along them lines? I did look at switching between subthemes for a specific content type, which on each of the subthemes would have different set .css styles but this could maybe get messy and quickly get out of control.
If you guys could give feedback on our build and how it compares to yours and how we could go about making more efficient that would mean a lot.
Guys, any help or suggestions at this time would be greatly appreciated.
Best Regards,
Joe
There are (at least) three modules which help you lay out and/or modify content on a page. They are: Panels, Context, and Display Suite. Here's an amazing tutorial which walks you through each of them so you can get an idea of how they are used. Use the dropdown at the top-left side of the page to jump to "Advanced Site Building" and scroll down from there.

Display content in two columns with fixed height in drupal

I'm in need of some pointing in the right direction here...
I have a site with a couple of different content types. I want to display this content in a book-like layout. The book should be of a fixed width and height and the pages should be populated with as many nodes as can fit. It should be in two columns, with the left column being filled before the right one.
How should i approach this?
I have been thinking about a few solutions, don't know which are possible and which one is best or which i can combine.
I could just create a view that selects more nodes than is need. Then check how long the nodes is in the theming layer and throw away the nodes that aren't needed. Pagers need to be fixed too.
Use panels in combination with views to display one view in two columns, if this is possible. Need a way to determine the amount of nodes that is displayed on each page, based on content length.
Write a plugin/handler for views so that i can select an amount of nodes that has an maximum, predetermined, max content length.
Write a new display-style for views that shows content in two columns with fixed heights.
Write a custom module, leave views and panels out of it and do everything myself with db_queries.
Would appreciate and guidance a lot. Not looking for a finished solution, i'm not afraid to code and i will contribute back if i create something that someone else can use (like a views plugin). Just need someone to guide me in the right direction :)
The hardest thing will be to figure out how much content you need to fill out the space. There's not really a good way to do that either since, it will depend on both the markup and the styles.
The best solution I can think of is loading the nodes with javascript, or maybe just have them available as javascript variables. That way you could insert the nodes to your page one by one. You could then in the JS see the heights of all the nodes in total, and once that height is bigger than x, you only need to remove the last inserted node.
It's not a perfect solution, but I think you should look at doing this with JavaScript. The only problem is, that it wont degrade gracefully very well.
Drupal help you build fast, and it looks like promising but fails to fullfil the needs of client, designer also programmer. You need to write one module page, and some functions.
5th solution you gave has little trouble than others. Write a function that to have "teaser like" behavior, I will return formatted node according to its type. Don't lay on drupal's teaser system. If teasers will have different heights, add height to teaser function.
I don't have a direct answer, but have a few things for you to think about.
It sounds to me like what you are looking for is a combination of a CSS3 Multicolumn Layout (see http://www.quirksmode.org/css/multicolumn.html for example) and limiting the displayed content to a fixed height.
My first thought would be to create a single view that gets more than you need, display it using CSS3 columns, and set overflow: hidden; for the container, so that the extra text is just hidden.
If you need to get more particular, you may need to dig in to the views rendering system to limit the total number of nodes based on how many characters have been rendered.
But since your desired constraint is more visual than data-oriented, I think that the most practical approach will be to use javascript to detect the text height and state of overflow.
There are some things that are unclear about your requirements. What is the purpose of the 2 content types? Does one display on the left and the other on the right? Or are these just 2 different content types that should behave the same way, but we're only seeing one content type at a time on a given page? What should happen with the overflowed content? Should it appear dynamically on page 2, then 3, then 4, and so on?
One parting thought: Maybe load ALL the content that you want to page through, directly to the browser. Maybe have it start off hidden. Then use javascript to display it, formatted into columns, and use javascript to handle the paging as well.

Drupal—Content Repetition & Consistency

I'm currently working on a Drupal site (I'm fairly new to Drupal) and need to be able to create some blocks of content that appear on multiple pages and remain consistent between those pages. I'll need it so that if I change the content in one place, the change will be reflected in all places it appears.
I've looked around in CCK a bit but can't seem to find a way to accomplish this there. Is there a way to accomplish this?
Thank you!
You can define your own blocks at /admin/build/block/add, just put your content inside a block and then go to "page specific visibility settings" and put the pages, on which the block should appear there.
There are other ways to achieve something like you describe, if the blocks don't do what you need you should provide some more details on what exactly you want to do. Depending on the structure of your site, you could also use a node (set to appear at the top of lists) that is set to appear on those pages.
It would depend of what kind of data you need to display in this block if its static use
/admin/build/block/add
if you intend to fetch some content from your content types use views to create such block and then use "page specific visibility settings".

Resources