Forum Replies Created

Viewing 15 replies - 1 through 15 (of 53 total)
  • Thread Starter tlw22

    (@tlw22)

    Great, thanks!

    Thread Starter tlw22

    (@tlw22)

    Thanks 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

    Thread Starter tlw22

    (@tlw22)

    Ah, 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

    Thread Starter tlw22

    (@tlw22)

    The 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!

    Thread Starter tlw22

    (@tlw22)

    Awesome thanks!

    Thread Starter tlw22

    (@tlw22)

    Cheers, will give it a go

    Forum: Plugins
    In reply to: Counting Comments
    Thread Starter tlw22

    (@tlw22)

    Yep, works perfectly. Thanks for all your help, much appreciated!

    Forum: Plugins
    In reply to: Counting Comments
    Thread Starter tlw22

    (@tlw22)

    Thanks, I will give it a go!

    Forum: Plugins
    In reply to: Counting Comments
    Thread Starter tlw22

    (@tlw22)

    The 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?
    Thread Starter tlw22

    (@tlw22)

    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?
    Thread Starter tlw22

    (@tlw22)

    Nope, no luck still

    Forum: Fixing WordPress
    In reply to: Auto-assign Image?
    Thread Starter tlw22

    (@tlw22)

    Ok, thanks for all your help! ?? https://wordpress.pastebin.com/vzjkhRRH

    Forum: Fixing WordPress
    In reply to: Auto-assign Image?
    Thread Starter tlw22

    (@tlw22)

    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 Thanks

    Forum: Fixing WordPress
    In reply to: Auto-assign Image?
    Thread Starter tlw22

    (@tlw22)

    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?
    Thread Starter tlw22

    (@tlw22)

    I’ve now eliminated the error however the picture doesn’t show as default next to the post name :/

Viewing 15 replies - 1 through 15 (of 53 total)