• Resolved Lia Red

    (@marapula)


    Hi,
    Can anyone help me figure out why my featured pages appear only when I choose no-sidebar template for the homepage? I want to use right-sidebar template but with featured pages section also visible.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Lia Red

    (@marapula)

    Or if I select no-sidebar in customize-it and right-sidebar in the page editor, it becomes a right-sidebar layout but the sidebar itself does not show.

    Thread Starter Lia Red

    (@marapula)

    This is the link to my site:
    https://ppa.stepphilippines.com/

    Hi,
    but do you use action hooks to move the featured pages after the content right?
    What do you exactly use?

    Thread Starter Lia Red

    (@marapula)

    In the child theme version of class-content-featured_pages.php, I changed the location to _before_footer.

    if ( ! class_exists( 'TC_featured_pages' ) ) :
      class TC_featured_pages {
          static $instance;
          function __construct () {
              self::$instance =& $this;
              add_action  ( '__before_footer'     , array( $this , 'tc_fp_block_display'), 10 );
          }

    Hi,
    I tried to do the same (though is discouraged) and it worked fine.
    You may have made other changes like that?
    Anyway don’t copy core files into the child-theme to modify them, use hooks, instead, in you child-theme functions.php .
    That’s ’cause when you upgrade your theme some classes you override in your child theme might make reference to some methods of the parent theme which have been changed in new version, or even removed in place of other methods (and vice versa).
    The correct way to do what you want is to put the following code in your child-theme functions.php

    add_action('after_setup_theme', 'move_fp_before_footer');
    function move_fp_before_footer(){
        if ( ! ( class_exists('TC_featured_pages') && method_exists('TC_featured_pages', 'tc_fp_block_display') ) )
            return;
        remove_action  ( '__before_main_container'     , array( TC_featured_pages::$instance , 'tc_fp_block_display'), 10 );
        add_action  ( '__before_footer'     , array( TC_featured_pages::$instance , 'tc_fp_block_display'), 10 );
    }

    Thread Starter Lia Red

    (@marapula)

    Thanks for that snippet! I corrected that so now my child theme only has the functions and css files. Re-installed the parent theme but the problem still exists. What other possible causes could there be? By the way, please disregard my 2nd post. It’s always only either the full-width template with featured pages or a sidebar template without featured pages.

    With sidebar template you mean, that you select a layout with one or two sidebars in Appearance -> Customize -> Content,,,.> Front Page right?
    So with or without this code above, I mean, also without moving the featured pages, they (fp) only work when you have a full layout?
    And selecting the same content to display (the static page I can see now?)
    Weird..
    I’m not able to reproduce this at all.
    Can you switch to a right sidebar layout and let me see?

    Ok, yes, isn’t printed,
    now remove those two widgets execphp

    They could be the culprits…

    Thread Starter Lia Red

    (@marapula)

    Yes, that’s what I mean by a sidebar template. And no, it only happens when I move the featured pages. If I don’t move anything, I can get both sidebar and featured pages to appear. I switched to a right sidebar layout for you to see what happens.

    Yeah,
    so probably in those widgets, you, or whoever, put some php code + did a WP_Query without calling wp_reset_query() (or wp_reset_postdata()) so basically when fp code goes to check if it’s the home page and it has the show the fps in there it fails ( because of the not reset query => not a Customizr issue ?? ).
    This can be the reason why fp fail after the sidebar (__before_footer action is done after the rendering of the sidebars ).

    Unrelated stuff:
    Anyway in your page I can see you have:
    – custom css:

    <style id="option-custom-css" type="text/css">1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    /* Remove Navbar box           */

    Remove those numbers (I know it’s something happens when you copy the code on the web, so just a typo)

    – your child-theme style.css is:

    <? php /*
    Theme Name: customizr-child
    Description: Description of your Child Theme
    Author: Your name here
    Template: customizr
    */
    
    @import url("../customizr/style.css");
    
    ? >

    (I put the spaces in the php tags) but a style.css is pure css so you don’t have to put the php starting and ending tags at all.
    Also the @import directive is useless when using Customizr, you can (have to => performances) get rid of it.

    Hope all that can help you to solve your issue and improve your site ??

    Thread Starter Lia Red

    (@marapula)

    Wow thank you so much! For solving my issue and all that extra input. Very helpful and much appreciated. I’m learning a lot ??

    Hi marapula,
    glad you solved ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘featured pages appearing only in no sidebar template’ is closed to new replies.