Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Page & Category Menu Bars (http://forum.bytesforall.com/forumdisplay.php?f=10)
-   -   Category menu to show the category posts in the dropdown (http://forum.bytesforall.com/showthread.php?t=2161)

gjchandler Jun 24, 2009 01:02 AM

Category menu to show the category posts in the dropdown
 
I would like to display the posts within specific categories in the category menu drop–down.

I've done something like this before in a different theme that was... well, more simple.

My category "Articles" displayed the posts within that category on a drop–down menu.

Code:

<li class="Largenav"><h2><?php _e('Articles'); ?></h2>
<ul> <?php
        global $post;
        $myposts = get_posts('numberposts=5&category=4');
        foreach($myposts as $post) :
        ?>
            <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
        <?php endforeach; ?>
 </ul></li>

Either where would I place this code in Atahualpa, or how else may I achieve the post–drop–down in this theme?

sam1327 Aug 11, 2009 06:26 AM

I would *really* like to be able to do this also. Clicking on the category dropdown menu to go directly to the post will open up my comments section, so visitors won't have to click twice.

So far I haven't been able to figure out how to do this, so I hope Flynn can help. :)

Flynn Aug 11, 2009 01:05 PM

Where exactly in the layout do you want to put that?

sam1327 Aug 11, 2009 07:25 PM

Hi Flynn,

I can't speak for gjchandler, but I myself meant on the horizontal navigation menu at the top.

So it's something like Category hover->dropdown action->Click to Individual posts within the Category

Prose Aug 15, 2009 10:52 AM

Hi Flynn: I want to +1 this feature. I'd like to have the ability for readers to pick a specific post by category.

Optionally, a way to figure out how to conditionally display a sidebar widget depending on category ID would be great. That way, I could list posts by category on the sidebar of category pages, and that would work.

(ps. I'm a fan and contributor... :-)

Flynn Aug 16, 2009 04:42 AM

The code of gjchandler should work. I'd use it without the opening and closing <LI>'s

<ul><?php
global $post;
$myposts = get_posts('numberposts=5&category=4');
foreach($myposts as $post) :
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>

You can put this into the text areas in the theme options such as Style & edit HEADER AREA -> Configure Header Area

To conditionally display widgets use the Widget Logic plugin http://wordpress.org/extend/plugins/widget-logic/


All times are GMT -6. The time now is 04:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.