• Resolved mvanboordt

    (@mvanboordt)


    I just updated to 4.4

    The tag cloud changed for some reason.
    I added it via the widgets.

    The html output was:

    <div class="sidebar">
        <ul>
            <li id="recent-posts-3" class="widget widget_recent_entries">
            <li id="categories-3" class="widget widget_categories">
            <li id="tag_cloud-2" class="widget widget_tag_cloud">
                <h2 class="widgettitle">TagCloud</h2>
                <div class="tagcloud">
                    <a class="tag-link-15" style="font-size: 12pt;" title="1 onderwerp" href="https://www.xxx.nl/themename/tag/tagname/">Tag Name</a>
                    <a class="tag-link-15" style="font-size: 12pt;" title="1 onderwerp" href="https://www.xxx.nl/themename/tag/tagname/">Tag Name</a>
                    <a class="tag-link-15" style="font-size: 12pt;" title="1 onderwerp" href="https://www.xxx.nl/themename/tag/tagname/">Tag Name</a>
               </div>
            </li>
        </ul>
    </div>

    The current html output is:

    <div class="sidebar">
        <ul>
            <li id="recent-posts-3" class="widget widget_recent_entries">
            <li id="categories-3" class="widget widget_categories">
            <a class="tag-link-15" style="font-size: 12pt;" title="1 onderwerp" href="https://www.xxx.nl/themename/tag/tagname/">Tag name</a>
            <a class="tag-link-15" style="font-size: 12pt;" title="1 onderwerp" href="https://www.xxx.nl/themename/tag/tagname/">Tag name</a>
            <a class="tag-link-15" style="font-size: 12pt;" title="1 onderwerp" href="https://www.xxx.nl/themename/tag/tagname/">Tag name</a>
        </ul>
    </div>

    I miss my div and my classes

    I can’t find anything about it in the update documentation so I don’t really know if this is an theme issue. The theme is custom btw and I have tried to switch to the new twentysixteen theme and have the same problem here.

    M.

Viewing 15 replies - 1 through 15 (of 15 total)
  • What theme are you using? Where did you download it from?

    Thread Starter mvanboordt

    (@mvanboordt)

    Please read the entire post. I use a custom theme

    Then I can only assume that your custom theme is calling the tag cloud in a non standard way. If the default output is not what you want, you could consider extending the default Tag Widget in your theme.

    Thread Starter mvanboordt

    (@mvanboordt)

    Don’t assume, read…

    I told you in the post that I use the widget area in the WordPress admin to add the widget. So I use a standard way to publish the tag Cloud.

    As I mentioned before I tried the twentysixteen theme and have the same problem here.

    Thnx for your help though…

    Hi

    I noticed the same thing in my own custom theme after updating to WP 4.4.
    All the wrappers / containers around the tag cloud appear to have disappeared breaking the styling.

    However I have a function in functions.php that reduced the number of tags shown in certain categories. Removing this appears to fix the issue (and my tags are once again wrapped in appropriate divs and therefore styled correctly with CSS), although I’ve now lost the control over how many tags are displayed in certain places.
    I’ve not looked into why this happens yet as this fix will do me for now. When I have time I’ll look a little deeper.

    Below is the code I’ve commented out in my functions.php. I originally added this myself, so unlikely to be in your functions.php, but the point is that I’ve tried to modify the tag cloud, and although it worked previously, fiddling with the tag cloud output in that way appears to break things or have changed considerably in WP 4.4.

    /**
    * Change output of Standard WP Tag widget - this seems to break things after update to WP 4.4
    **/
    
    add_filter('widget_tag_cloud_args','style_tags');
    function style_tags($args) {
    
    	//Show fewer tags on Some-Category archive page
    	if (  is_category('some-category') ) :
    		$number = '24';
    	else :
    		$number = '30';
    	endif;
    
    	$args = array(
    		 'largest'    => '10',
    		 'smallest'   => '10',
    		 'format'     => '',
    		 'number'       => $number,
    		);
    	return $args;
    }

    Cheers
    Stef

    I have the same problem on my website.
    I also use a function to reduce the number of tags.
    Styling is broken by default, but if I login to my WP Admin and update the function, the changes seem to work.

    Then, when I logout, the styling is messed up again.

    Thread Starter mvanboordt

    (@mvanboordt)

    Glad to see that I’m not the only one who has this problem.

    But is still remains.
    I have no answer/solution yet so I’ll keep on looking at it.

    I even consider to create my own tagcloud so the problem is sort of fixed.

    M.

    Thread Starter mvanboordt

    (@mvanboordt)

    @tictok
    Because of your post I was bound to take a look into my functions.php and found:

    add_filter('widget_tag_cloud_args','set_tag_cloud_args');
    function set_tag_cloud_args($args) {
    	$args = array(
    		'smallest' => 12,
    		'largest'   => 12,
    		'unit' 	=> 'pt',
    		'order'	=> 'ASC', );
    	return $args;
    }

    After I deleted this from my functions.php the whole thing worked again. However the arguments passed to the tag cloud functions were disabled.

    So I have to find a way to pass the arguments………

    M.

    Thread Starter mvanboordt

    (@mvanboordt)

    Well…

    I fixed with css by setting the font-size to 12px and overruled it with an !important.
    Not the most elegant solution but for now…..

    Still have to find out how I can pass the order..

    Hello. I had the same problem and now I fixed it.

    You can fix it by changing your function like follows (let me use mvanfoordt’s example):

    function set_tag_cloud_args($args) {
    	$my_args = array(
    		'smallest' => 12,
    		'largest'   => 12,
    		'unit' 	=> 'pt',
    		'order'	=> 'ASC', );
    	$args = wp_parse_args( $args, $my_args );
    	return $args;
    }

    Until WP 4.3.x, wp_tag_cloud function was used to directly output (‘echo’ => true), which is the function’s default behavior. In WP 4.4, however, the function is used to set the tag cloud into a variable as a string, without output (‘echo’ => false).

    The original description of the custom function overrides the default arguments, where ‘echo’ is set to false. So tag cloud was output at wrong timing (before output of wrapper and title). To resolve it, arguments should not be override, instead, custom arguments should be merged with default arguments.

    Hope I could have explained well and it helps you.

    Thread Starter mvanboordt

    (@mvanboordt)

    Wow.

    Thank you. Great fix and explanation.

    I will try it and let you know!!

    M.

    Thread Starter mvanboordt

    (@mvanboordt)

    Dude,

    Like a charm.

    Thank you!

    @afainu – Thanks a lot for the code.
    Works flawlessly.

    This worked great, thanks for the fix!

    Thanks, @afainu. I was tearing my hair out.

    It also works if one simply adds…
    'echo' => false
    … to the arguments, using only $args (and no wp_parse_args).

    But if I understand your explanation, that would “lose” any other defaults not expressly added to the custom function.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘WordPress 4.4 update broke Tag Cloud’ is closed to new replies.