Tagged: bug, featured content, front page
- This topic has 2 replies, 2 voices, and was last updated 9 years, 5 months ago by
Sakin.
-
AuthorPosts
-
March 18, 2015 at 7:35 pm #53655
widespread
MemberHi CatchThemes, thanks for your free themes.
I’ve been scratching my head a lot for a problem I encountered in catchbase-featured-content.php.
What I am doing is using the Polylang multi-language plugin. This plugin simply adds a way to create pages or posts which are translations of each other.
The problem is, I’ve currently set the catchbase slideshow and featured-content to show in frontpage only (which is a static page, and has a sibiling translated page).
Now, while the slideshow will show both in the original and in the translated version of the frontpage, the featured content does not.Looking at the code in catchbase-featured-content.php I could find that this condition is still satisfied in the translated version of the page:
if ( $enablecontent == 'entire-site' || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && $enablecontent == 'homepage' ) ) { // create featured content HTML wrapper }
so I think it’s not a problem with the translated page’s URL not being recognized as front-page.
But going down below, in catchbase_page_content function, the actual WP-Query fails to return the featured content:
if ( !empty( $page_list ) && $number_of_page > 0 ) { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number_of_page, 'post_type' => 'page', 'post__in' => $page_list, 'orderby' => 'post__in' )); // $get_featured_posts->have_posts() returns false in the translated page // while ( $get_featured_posts->have_posts() ) ... // loop for creating and showing featured content HTML.. }
Specifically, have_posts() returns false only in the translated version of the page, and I could not find a reason for this.
I also took a look at catchbase-featured-slider.php because they are similar and this code instead is able to return and show the slideshow content in both the translated and the origianl versions of the pages, but I could still not understand what is going wrong in catchbase-featured-content.php.I really hope you can help me with this.. I don’t know where else to look for.. maybe this could also turn out into a possible bug fix for Catch Base theme (provided it’s a bug) ?
Thanks a lot!Alfredo
March 18, 2015 at 9:48 pm #53669widespread
MemberI “fixed” it! It was not at all a issue with catch-base “catchbase-featured-content.php” but it’s just how Polylang works instead! What it does is that it will display the featured content posts for a translated page, only if the relevant translated version of the featured content posts exists too.
So for example if I am in the Spanish version of my front-page, the featured-content loop will only be able to fetch those posts which also have a Spanish translation!
So again nothing to do with Catch Base which perfectly does its job.
It was only confusing me that on the front-page the slideshow could still show the non-translated posts’ images, so I erroneously suspected that there was a problem in the featured-content query code.All working now, but I think Polylang developer should read this and made it more clear how his plugin modifies the query system, because without knowing that one could easily spend hours after hours of hair pulling…
Thanks, I hope I did not make you waste time. You can mark this as solved.
March 18, 2015 at 11:27 pm #53677Sakin
Keymaster@widespread: Thanks. We haven’t tested this theme with Polylang and it’s great that it is working fine. Cheers 🙂 Thanks for your detail information. This post will really help other who want to use Polylang plugin in Catch Base theme.
Thanks a lot 🙂
-
AuthorPosts
- The topic ‘problems in catchbase-featured-content.php’ is closed to new replies.