• Resolved Anonymous User

    (@anonymized-10133093)


    Hello!

    I am using this snippet, updated from the comments Oct 2016:

    https://presscustomizr.com/snippet/move-featured-pages-block-anywhere-front-page/

    (actual code copied from my child functions.php)

    //we hook the code on the wp_head hook, this way it will be executed before any html rendering.
    add_action ( 'wp_head' , 'move_my_fp');
    function move_my_fp() {
    	//we unhook the featured pages
    	remove_action  ( '__before_main_container', array( CZR_featured_pages::$instance , ‘czr_fn_fp_block_display’), 10 );
    
    	//we re-hook the block. Check out the priority here : set to 0 to be the first in the list of different actions hooked to this hook 
    	add_action  ( '__after_main_container', array( CZR_featured_pages::$instance , ‘czr_fn_fp_block_display’), 0 );
    }

    And after the new WordPress update I get:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'CZR_featured_pages' does not have a method '‘czr_fn_fp_block_display’' in /home/xxx/xxx/xxx/wp-includes/class-wp-hook.php on line 298

    I am totally ignorant of PHP, can anyone spot what is wrong and correct the code?! The comments section is shut on the relevant snippets page unfortunately!

    THANKS SO MUCH!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @david1103
    the problems in the snippet you posted are the quotes wrapping the method name (czr_fn_fp_block_display)
    wrong ->
    right -> '

    Hope this helps.

    Thread Starter Anonymous User

    (@anonymized-10133093)

    Thanks Rocco!

    You have solved the error message, but unfortunately the snippet now does not work. The featured pages block goes back to the bottom of the page when it is meant to be at the top.

    When the error message was showing, before I made your correction, the featured pages block was at the top where I wanted it, can you weave another magic code spell to fix it? THANKS!!

    This says where it should be:
    ‘__after_main_container’

    so the snippet works :D, that’s what the snippet you posted does ??

    you can use ‘__before_header’ instead (but you have to disable the sticky header if you use it) – as the original snippet.

    Hope this helps ??

    Thread Starter Anonymous User

    (@anonymized-10133093)

    I have no idea why it worked before but not now, but you pointed out the obvious! Cheers!

    I changed it to:

    add_action ( '__after_header', array( CZR_featured_pages::$instance , 'czr_fn_fp_block_display'), 0 );

    and it now goes back to where it was meant to be ??

    • This reply was modified 7 years, 10 months ago by Anonymous User.
    • This reply was modified 7 years, 10 months ago by Anonymous User.

    Ah ok, I see.
    Glad you solved ??

    p.s.
    please, would you mind marking this topic as resolved?
    Many thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP 4.7 Breaks ‘(updated) Move the featured pages’ Snippet’ is closed to new replies.