Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8707223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:49:03+00:00 2026-06-13T03:49:03+00:00

This is the website i´m working on: http://canal.es/wordpress/ The problem I have is that,

  • 0

This is the website i´m working on: http://canal.es/wordpress/

The problem I have is that, if you go, to “Pasteleria dulce” (which is a category.php file) it shows a left sidebar with the active title of the category, it shows a post on the center and it shows below the image a list of the post of the same category.

I haven´t find a solution to highlight the post title that opens automatically when I enter to the category. This is the code i´m using on the category.php file:

    <!--  Highlight menu from current category -->
    <?php
        if (is_category()) {
            $this_category = get_category($cat);
            }
        if($this_category->category_parent)
            $this_category = wp_list_categories('orderby=id&title_li=&child_of='.$this_category->category_parent."&echo=0"); else
            $this_category = wp_list_categories('orderby=id&title_li=&child_of='.$this_category->cat_ID."&echo=0");
        if ($this_category) { ?>
        <ul class="sub-menu">
            <?php echo $this_category; ?>
        </ul>
    <?php } ?>



    <div class="producto_column">           
       <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>

            <div class="producto_image">
                <img src="<?php the_field('imagen_producto'); ?>" alt=""/>
            </div>

                <div class="share_item">
                    <a class="minimal" id="premium">
                        <img src="<?php bloginfo('template_directory') ?>/images/share.png" alt="share">
                    </a>
                    <a class="maillink" href="http://canal.local/?page_id=220">
                        <img src="<?php bloginfo('template_directory') ?>/images/email.png" alt="email">
                    </a>
                </div>

            <?php get_template_part( 'content', get_post_format() ); ?>

        <?php endwhile; ?>

    <!--  Post list from current category -->
    <ul id="submenu_productos" class="clearfix">
        <?php
            $IDOutsideLoop = $post->ID;
            while( have_posts() ) {
                the_post();
                foreach( ( get_the_category() ) as $category )
                    $my_query = new WP_Query('category_name=' . $category->category_nicename . '&orderby=title&order=asc&showposts=100');
                if( $my_query ) {
                    while ( $my_query->have_posts() ) {
                        $my_query->the_post(); ?>
                <li<?php print ( is_single() && $IDOutsideLoop == $post->ID ) ? ' class="test"' : ''; ?>>
                    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> |
                </li>
        <?php
                }
            }
        }
        ?>
    </ul>

How can I make active the current post title that appears when I open the category page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:49:04+00:00Added an answer on June 13, 2026 at 3:49 am

    Try to use this solution:

    <ul>
    
        <?php
            $lastposts = get_posts('numberposts=5&orderby=rand&cat=-52');
            foreach($lastposts as $post) :
            setup_postdata($post); ?>
    
            <li<?php if ( $post->ID == $wp_query->post->ID ) { echo ' class="current"'; } else {} ?>>
    
                <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    
            </li>
    
        <?php endforeach; ?>
    
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website that I am working on: http://keramed.com in FireFox on my
I have a view all category on the website I am working on (http://www.thetradinghouse.co.nz/view-all).
I'm currently working on this website and have just noticed a problem with the
http://test.rfinvestments.co.za I've been working on this website for a little while and, now that
I'm working on this website http://www.eluminatecreative.com/new/index.html and where it says sum'r fling I need
I'm working on this website in WordPress and I want the content with the
I have a working website, where I use this expression everywhere. price.ToString(C) It currently
I am getting this error on a website I'm working on, I have simplified
I followed this link to gzip my php driven website It's working fine but
I've got this ASP.NET 2.0 website project in Visual Studio that I've been working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.