harshclimate
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Conditional Statement for Showing CommentsOh, I forgot to mention, too, that the code above is OUTSIDE the loop.
Forum: Hacks
In reply to: Adding post_class to the loopUse article for sure. If it’s news, use article. That’s what’s so nice about html5 is that it’s as semantic as you’d like.
Forum: Hacks
In reply to: Displaying Taxonomy and DescriptionsYikes, well I’m glad you were able to catch that. Thanks! I’m trying to kind of redesign that page a little bit. I don’t really see the use in my having an edit link on each one. Obviously when I’m logged in I can just right to it too.
I’m only decent at html/css. When it comes to php and creating conditional statements… well… let’s just say the only work-arounds I can really come up with is just eliminating the idea if I can’t see an obvious fix for it.
For some reason, php and me don’t mix. As much as I love what php is and can do, I just could never grasp it. The more I mess around with wordpress, maybe the better chance I have at understanding it a little more ??
Forum: Hacks
In reply to: Displaying Taxonomy and DescriptionsThanks you guys.
Yeah, swayam, the descriptions are there because I wanted them to be but I should maybe shorten them so it doesn’t take up too much of the page. I’m currently redesigning that whole area now.
bcw, thanks for the edit link! I’ll plug that in shortly. I think the current php that is there now will only show up if an admin is logged in, isn’t it?
okay, thanks.
Forum: Hacks
In reply to: Displaying Taxonomy and DescriptionsHere’s the page where I’m trying to echo the edit link. I’m hoping right at the end of the category count:
Forum: Hacks
In reply to: Displaying Taxonomy and DescriptionsThanks, bcw. Yeah, I didn’t realize that you couldn’t echo terms that were not assigned to a post. That’s kind of what confused me at first.
Now I’m trying to add an edit category link from the list of categories. My php experience is in the negatives. All I really know is <?php echo “sup”; ?>.
What I was able to copy and use on my page-categories.php is this bit of code:
<?php echo "\n" . '<div class="row">'; $categories = get_categories( array( 'orderby' => 'name', 'order' => 'ASC' ) ); foreach( $categories as $category ) { $category_link = sprintf( '<a href="%1$s" alt="%2$s">%3$s</a>', esc_url( get_category_link( $category->term_id ) ), esc_attr( sprintf( __( 'View all posts in %s', 'textdomain' ), $category->name ) ), esc_html( $category->name ) ); echo '<div class="col span-12">'; echo '<span>' . sprintf( esc_html__( '%s', 'sts' ), $category_link ) . '<span class="beenused">' . sprintf( esc_html__( 'has been used %s times', 'sts' ), $category->count ) . '</span>' . '</span>'; echo '<p>' . sprintf( esc_html__( '%s', 'sts' ), $category->description ) . '</p>'; echo '</div>'; } echo '</div>'; ?>
So somewhere in that mess I’m trying to spit out:
<?php // Get the ID of a given category $category_id = get_cat_ID( 'Category Name' ); // Get the URL of this category $category_link = get_category_link( $category_id ); ?> <!-- Print a link to this category --> <a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>
Forum: Hacks
In reply to: Displaying Taxonomy and DescriptionsI seriously doubt anyone will ever respond to this topic but I’ll do some typing out loud:
My main goal was to display all categories that I have added to every single post. What I didn’t mention, was that I wanted to display all categories that I have not assigned to a post and that just isn’t possible I don’t think. I mean, how can you display a category if it hasn’t been assigned to anything, right? I didn’t quite think that one through before I posted on wordpress.
After searching around on the internets, I’ve discovered that what I really wanna do is display all posts according to the category. There’s tons out there on that one. But the hitch is, I would love to be able to display the DESCRIPTION of the category under the category name. Then display all the posts under that.
Anyway, thanks for any thoughts on this one…