NoahRodenbeek
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Method to Identify Category Returns Post ID Instead, :(Nevermind I figured it out finally:
<
?php
$id = get_the_category();
$cat_id = $id[0]->cat_ID;
//echo $cat_id;//get array of Posts for Category, default is ‘order by date’, set it to Ascending instead of default Descending
$args = array( ‘category’ => $cat_id, ‘order’ => ‘ASC’ );
$posts = get_posts( $args );
//echo $posts[0]->guid;//display
- link that jumps to first item in Posts Array
$link = $posts[0]->guid;
echo ‘FIRST‘;
?>
Forum: Fixing WordPress
In reply to: Method to Identify Category Returns Post ID Instead, :(<?php
get_cat_name( $id );
echo $id;
$posts = get_posts(array(‘category’ => $id));
print_r($posts);
?>That’s everything that’s going on, so that “Array[]” that’s being displayed is an empty array as result of the second get_ failing
Forum: Fixing WordPress
In reply to: Method to Identify Category Returns Post ID Instead, :(Here: http://verymintcomics.com
I’m echoing the $id below the comic, in the Navigation bar, it’s being displayed right before the “PREVIOUS” link, see?
If you jump to other comics you can see how it’s displaying the post’s ID instead of its Category.
Thanks for the reply! I really need help with this.
- link that jumps to first item in Posts Array