Updated : works fine with Featured Pages Unlimited v1.4+
The featured pages are composed by 4 blocks ordered as follow by default :
- Image
- Title
- Excerpt (or custom text)
- Button
With the following snippet you can define a new order for those blocks. Just change the order of the items in the $my_item_order array in the code below.
In this example, the title is moved before the image.
add_action('wp_footer' , 'set_fp_item_order'); function set_fp_item_order() { $my_item_order = array( 'title', 'image', 'text', 'button', ); ?> <script type="text/javascript"> jQuery(document).ready(function () { ! function ($) { //prevents js conflicts "use strict"; var my_item_order = [<?php echo '"'.implode('","', $my_item_order).'"' ?>], $Wrapper = ''; _ if ( 0 != $('.widget-front' , '.marketing' ).length ) { $Wrapper = $('.widget-front' , '.marketing' ); } else if ( 0 != $('.fpc-widget-front' , '.fpc-marketing' ).length ) { //for FPU users $Wrapper = $('.fpc-widget-front' , '.fpc-marketing' ); } else { return; } <?php if ( defined( 'CZR_IS_MODERN_STYLE' ) && CZR_IS_MODERN_STYLE ): ?> var Selector = { title: '.fp-title', image: '[class*=-thumb-wrapper]', text: '.fp-excerpt', button: '.fp-button' } <?php else: ?> var Selector = { title: 'h2', image: '.thumb-wrapper', text: 'p', button: 'a.btn, a.fp-button' } <?php endif; ?> $Wrapper.each( function() { var o = []; o['title'] = $(this).find(Selector.title); o['image'] = $(this).find(Selector.image); o['text'] = $(this).find(Selector.text); o['button'] = $(this).find(Selector.button); for (var i = 0; i < my_item_order.length - 1; i++) { o[my_item_order[i]].after(o[my_item_order[i+1]]); }; }); }(window.jQuery) }); </script> <?php }
Where to paste this code? => in your functions.php file. I strongly recommend to create a child theme. Download a start-up child theme here.
Everything you need to know about child theme with Customizr here.
15 thoughts on “Reordering the featured page elements : title, image, text, button”
my web site is showing the same text of the 3 icon on featured page element on my home page, how can i make for each title his own text?
Hi Sonia, you’ll want to edit your featured pages settings in Appareance > customize to do that.
http://doc.presscustomizr.com/customizr/content-options/#featured-pages
Hey , thanks for the great post, I am tryin to get the featured image to display on my pages and posts after the title. can you please tell me a way to achieve it.
Hi,
I’m quite new to wordpress and I haven’t got a strong IT background. I love the customizr theme – it’s perfect.
However, there is one little niggle. I don’t prefer how the post summaries appear on a page – in an alternating way i.e. Post 1: Image then text, Post 2: Text + Image, etc
How can I change this?
Hi, you might want to check the guide on how to customize the theme.
You can also post a new topic in the support forum about this to see if a user has already done this.
Hope this helps !
Hi Rocco, I have it sorted. I’m not sure why the file wasn’t being picked up. But I changed it directly from within Wordpress (appearances>editor>functions.php). The code above is good. Thanks for your help. Teri
Hello Tery,
glad you solved. Most likely was a caching issue. Probably a cached W3TC page was loaded.
😀
Bests
Hi, I’m using a child theme of Customizr. After I updated Wordpress, my Featured Pages didn’t work. I upgraded Featured Pages and they came back but not like they did before the upgrade. Previously I used a code snippet in functions.php to get the title moved before the image. It was slightly different than what is listed above but, when I initially implemented it in Sept 2013, it worked well.
I’m trying to get back to having the title above the image. I updated functions.php to use the code exactly as above but it’s not working. Can you help pls? I also emptied cache in case this was causing a problem. System info here: http://pastebin.com/0t9wg7Qp
Hello Teri,
I went to your page and I can see that you’re not using the code above, but maybe still an older version.
That’s the code you have in your page: http://pastebin.com/3wrHnsin
Did you try to clean the W3 Total Cache cache?
Hi Rocco, that is the older code. I definitely cleared the cache. I was going to do this again ‘just in case’ but there was no option as the cache had been cleared. How did you find the old code? I’m wondering if WP is looking in a new location.
When I originally set this up in 2013, I used a plugin to create the child theme which is located in a themes sub-folder of wp-content called customizr-child. I definitely have the new code but it doesn’t seem to be picking it up.
HI, how can be the titles of featured pages as well a link to the pages? using Featured Pages Unlimited v1.4+
Thanks
Hi meike, you might want to have a look at this new snippet: http://presscustomizr.com/snippet/make-featured-pages-titles-linkable/
okay, i found my mistake. i forgotten the “<?php" in the beginning of the functions.php
Hi!
i put the codeine the function.php from my child-theme. When i open the homepage, i get an error on line 41. Can anyone help me?
And: how can i use the theme with 4 “buttons”? tanks a lot!
Rik
Hai Nic,
Im glad for known ur themes from 77studio, but i’ve got a little problem, when i set a pages ( i created welcome pages ) for the front page menu section on your themes. I can’t save and publish it, i just got a preview only, even i have click “Save and Publish” Button severals times.
Would you like to help to solves this problems my friend? Thanks you for your attention and helpful
Best regards,
Ken