mercredi 6 novembre 2019

IF WORDPRESS Pagination

what I want is that in the pages of the home of wordpress older than page / 2 onwards, get "wawawawawaw" But it does not work. It always activates the else, apparently I'm doing the wrong thing.

My code is:

function my_added_page_content ( $content ) {
$paged = ( get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1 );
    $page = ( get_query_var( 'page' ) ? absint( get_query_var( 'page' ) ) : 1 );
    $paged = max($page,$paged);

    if(!is_admin() && is_home() && (empty($paged) || $paged < 2)){ // Check is front-end and is shop page and is first page  
   $content = 'wawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawa';
    }
    else{
        $content = 'pepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepepe';
    }
    return $content;
}
add_filter( 'the_content', 'my_added_page_content');

What am I doing wrong? Thank you!

Aucun commentaire:

Enregistrer un commentaire