tlw22
Forum Replies Created
-
Forum: Themes and Templates
In reply to: List Categories Of PostsGreat, thanks!
Forum: Themes and Templates
In reply to: List Categories Of PostsThanks it worked a treat, is there anyway to remove a certain category from the listing but keep it selected still? I’m using the ‘Uncategorized’ category to displays my posts on another page but equally I don’t want the category being displayed. Hope this makes sense? Cheers
Forum: Themes and Templates
In reply to: Links to categoriesAh, found a solution:
<?php $category = get_the_category(); if ($category) { echo '<a href="' . get_category_link( $category[0]->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category[0]->name ) . '" ' . '>' . $category[0]->name.'</a> '; } ?>
^Posted by another person on the forums
Thanks for your help
Forum: Themes and Templates
In reply to: Links to categoriesThe code works great, however, I would like a more automated process, so that the category changes with whatever I change it to on the post page.
Actually, change of plan, do you know how to find the link of a category page (couldn’t seem to find it anywhere)?
I’m gathering it would look something like sitename.com/category=gaming (with name at the end?)
This way I can then add the url slug of the category to the end of the link url when inputted in.
Hope this makes sense, haha, cheers!
Forum: Themes and Templates
In reply to: How to apply category to pageAwesome thanks!
Forum: Themes and Templates
In reply to: Show all posts on another pageCheers, will give it a go
Forum: Plugins
In reply to: Counting CommentsYep, works perfectly. Thanks for all your help, much appreciated!
Forum: Plugins
In reply to: Counting CommentsThanks, I will give it a go!
Forum: Plugins
In reply to: Counting CommentsThe
author_comment_count();
is defined in the functions file:// Displays no. comments function author_comment_count(){ $oneText = '1'; $moreText = '%'; global $wpdb; $result = $wpdb->get_var(' SELECT COUNT(comment_ID) FROM '.$wpdb->comments.' WHERE comment_author_email = "'.get_comment_author_email().'"' ); if($result == 1): echo str_replace('%', $result, $oneText); elseif($result > 1): echo str_replace('%', $result, $moreText); endif; }
I’m not sure if the function is already returning the value, but if not, how can I get it to do so?
Thanks!
Forum: Fixing WordPress
In reply to: Auto-assign Image?Just browsed the web and found a similar piece of code. In short, I’ve mixed the two pieces of code together and to anyone who would like to know, here is the solution:
Place wherever:<?php query_posts('showposts=3'); // recent 3 posts while(have_posts()) : the_post();?> <div class="my-post"> <img src="<?php get_post_thumbnail(); ?>" alt="<?php the_title(); ?>" class="front-list_thumbnail" width="32" height="32"/><? echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>'; ?></div> <?php endwhile; wp_reset_query(); ?>
Place in functions.php:
function get_post_thumbnail() { $files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image'); if($files) : $keys = array_reverse(array_keys($files)); $j=0; $num = $keys[$j]; $image=wp_get_attachment_image($num, 'large', false); $imagepieces = explode('"', $image); $imagepath = $imagepieces[1]; $thumb=wp_get_attachment_thumb_url($num); print $thumb; else: print "https://www.chrs.biz/theme1/wp-content/themes/twentyten/images/wordpress.png"; /* link for default image */ endif; }
Thanks for all your help esmi ?? Hope this piece of code can help someone, enjoy!
Forum: Fixing WordPress
In reply to: Auto-assign Image?Nope, no luck still
Forum: Fixing WordPress
In reply to: Auto-assign Image?Ok, thanks for all your help! ?? https://wordpress.pastebin.com/vzjkhRRH
Forum: Fixing WordPress
In reply to: Auto-assign Image?When entering the above code the syntax breaks and displays an error? It states:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/iappleg1/public_html/chrs.biz/theme1/wp-content/themes/twentyten/sidebar.php on line 26
ThanksForum: Fixing WordPress
In reply to: Auto-assign Image?Nope, so I instead changed the link to:
<img src="https://chrs.biz/theme1/wp-content/themes/twentyten/images/wordpress.png" width="32px" height="32px" alt="" />
Not too sure why it’s not working, guess I really need to learn php!Forum: Fixing WordPress
In reply to: Auto-assign Image?I’ve now eliminated the error however the picture doesn’t show as default next to the post name :/