• Hi!

    I have such a strange desire: to have different links categories displayed for different posts categories.

    My opinion, that it is easy to do using cat_ID

    <?php
    $catid = get_the_category();
    $catid = $catid->cat_ID;

    wp_get_links($catid);

    ?>
    (correct me if I’m wrong)

    But how I can put it only on the first category page, where last (most recent) posts are located?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Alex Petrenko

    (@petrenkocomua)

    Yes, I’m wrong. It isn’t working…

    Thread Starter Alex Petrenko

    (@petrenkocomua)

    Thanks a lot for support ??

    Almost solved using:

    <?php
    $linker = get_query_var( ‘cat’ );
    if ( is_home() ) { wp_get_links(1); }
    elseif ( is_category() ) {wp_get_links($linker); }
    ?>

    BUT remains:

    How can I put it only on the first category page, where last (most recent) posts are located?

    Thread Starter Alex Petrenko

    (@petrenkocomua)

    Thanks a lot for your kind support. I have impression, that questions raised by me are absolutely unresolveable.

    So, that’s the solution:

    <?php /* If this is the frontpage */
    if
    ($_SERVER[“REQUEST_URI”] == ‘/’)
    { ?><div class=”link_box”>Main Links</div>

      <?php wp_get_links(1); ?>

    <?php }

    elseif
    ($_SERVER[“REQUEST_URI”] == ‘/category/uncategorised/’)
    { ?><div class=”link_box”>Uncategorised links</div>

      <?php include(‘lnk-category-uncategorized.txt’); ?>

    <?php }

    elseif
    ($_SERVER[“REQUEST_URI”] == ‘/category/stuff/’)
    { ?><div class=”link_box”>Stuff links</div>

      <?php include(‘lnk-category-stuff.txt’); ?>

    <?php }

    elseif
    ($_SERVER[“REQUEST_URI”] == ‘/category/other/’)
    { ?><div class=”link_box”>Other links</div>

      <?php include(‘lnk-category-other.txt’); ?>

    <?php }

    else
    { wp_get_links(2); } ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Separate links group for each initial page of category’ is closed to new replies.