ViewedShortcode & Offset?

  • Author
  • Ernst Michalek

    for an online magazine of a customer I would need the following function: posts are often split by <!–nextpage–>-Tags. They want to insert a shortcode in the first page with e.g. one related post, and in the following pages shortcodes with e.g. the next 3 related posts, with a different layout. Is it possible with your plugin to trigger different layouts and display a subset of related posts (e.g. via a count and an “offset”-switch) by shortcode?


    Hello, I understand:
    -First page (1 design)
    -Second, third, fourth page (another design).

    At the moment this is not possible. But I recommend that if you know CSS you can do it manually.
    It occurs to me in this way:

    Within your file functions.php put this code.

    add_action( 'wp_head', function(){
      global $wp_query;
      $page = $wp_query->query_vars['page'];
      if( empty($page) || $page == 0 ): ?>
        <style>.yuzo_related_post .relatedthumb{background:red!important;}</style>
      <?php else: ?>
        <style>.yuzo_related_post .relatedthumb{background:blue!important;}</style>
    } );

    With this you will get on the first page have a design the “related post” and with the second page onwards have another design customized by you. 😎

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.