• wpapm

    (@wpapm)


    Hi Marcel,

    Thanks again for the great add-on! I was able to use it again earlier.

    Is there a way to transfer the page number from the guestbook into a template?

    So that I can, for example, adjust the heading on each page according to the page number.

Viewing 1 replies (of 1 total)
  • Plugin Author Marcel Pol

    (@mpol)

    Hello, I am sorry for the slow reply.

    Attached is some example code. The function can be used as a template function. The filter will add it to the title.
    This code can be added to the functions.php of your theme, preferably a child theme, or to your own custom plugin.
    You can manage? Questions are welcome.


    function my_gwolle_gb_get_page_number() {

    if ( is_admin() ) {
    return 0;
    }

    if ( isset( $_GET[ 'pageNum' ] ) ) {
    $pageNum = (int) $_GET[ 'pageNum' ];
    return $pageNum;
    }

    return 0;

    }

    function my_gwolle_gb_add_page_number_to_title( $title ) {

    $pageNum = (int) my_gwolle_gb_get_page_number();

    if ( $pageNum > 0 ) {
    $title .= ' Page: ' . $pageNum;
    }

    return $title;

    }
    add_filter( 'the_title', 'my_gwolle_gb_add_page_number_to_title', 10, 1 );

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.