wordpress / php help
- Started
- Last post
- 30 Responses
- vaxorcist0
in programming, sometimes explaining the problem is much harder than solving it
- dbloc0
ha haa. I agree
- dbloc0
I've got another problem I'm trying to figure out.
I am setting $currentSec = "events"; at the top of the page template before the header loads.
I want to use this to light up the nav in header
<?php if(is_page('events') || is_single() && in_category('events') || $currentSec == 'events'){ echo ' class="active"'; } ?>
the variable doesn't seem to be working on the template page that I set the variable on
(probably another bad explanation)
- dbloc0
figured it out.
you have to define the variable in the header file:
<?php global $currentSec; ?>and then in the template page set
$currentSec = "events";
- dbloc0
New Question
--------------------------------I am trying to list the posts from category 185 in the sidebar in alphabetical order. Nothing seems to be working for me.
<.ul>
<.?php $temp_query = $wp_query; query_posts("showposts=100&cat=185"); ?>
<.?php while (have_posts()) { the_post(); ?>
<.li><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<.?php } $wp_query = $temp_query; ?>
<./ul>
- dbloc0
tried adding
&orderby=title&category=1
also tried
$query_string . '&orderby=title&order=asc&posts...
also tried
&orderby=title&order=asc
- dbloc0
I am just trying to list all posts in one category in alphabetical order. anyone?
- vaxorcist0
what goes wrong with the code above? or does it just nothing different?
- dbloc0
this is on a single page sidebar (template) by the way if that matters
- vaxorcist0
first, try to actually "print" the query string, as you may have to change the order of things...
<.ul>
<.?php $temp_query = $wp_query;
print "\n\n\n<!-- Query: $temp_query -->\n\n\n";
query_posts("showposts=100&cat=1... ?>
<.?php while (have_posts()) { the_post(); ?>
<.li><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<.?php } $wp_query = $temp_query; ?>
<./ul>---
then, show the commented query here, and we mgiht debug it....