Put Slug into Variable
-
I’d like to use the information in my slugs in one of my templates. I’d like to parse it and use it in some headings.
What do I need to do to put it into a variable? I’ve got a nice query working and it’s pulling back the proper data but how do I get at the slug data? I’m new to php/mySQL so it’s probably a matter of some simple syntax. I got this nice syntax from this site and modified it.
<?php $querystr =" SELECT $wpdb->posts.* FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE $wpdb->postmeta.meta_key = 'calendar' AND $wpdb->postmeta.meta_value = 'yes' ORDER BY $wpdb->posts.menu_order ASC"; $pageposts = $wpdb->get_results($querystr, OBJECT); if ($pageposts): foreach ($pageposts as $post): setup_postdata($post); ?> <strong><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <?php the_title(); ?></a></strong><br /> <?php the_content(__('(more...)')); ?> <?php endforeach; ?> <?php else : ?> <h2> Not Found</h2> <?php endif; ?>———————
TIA!Codecottage
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Put Slug into Variable’ is closed to new replies.