Foreach giving one too many list items, how can I remove the last empty line?

I’ve managed to find the answer to my problem of empty custom fields showing on the page. /** Get Fitness Custom Fields from listing page **/ add_filter( ‘woocommerce_single_product_summary’, ‘something_custom_fields’, 23 ); function something_custom_fields() { //Get picture from post meta or template directory $thumb = get_post_meta($post->ID,’Thumbnail’, true); $thumb = ( !empty( $thumb ) ) ? $thumb … Read more

Excerpt all post content Content Same Size without word cutting off

I use wp_trim_words to create multiple excerpts. I always abuse it when I need more than one excerpt length. Here is how function wpse_custom_excerpts($limit) { return wp_trim_words(get_the_excerpt(), $limit, ‘<a href=”‘. esc_url( get_permalink() ) . ‘”>’ . ‘&nbsp;&hellip;’ . __( ‘Read more &nbsp;&raquo;’, ‘wpse’ ) . ‘</a>’); } What this function do is taking get_the_excerpt trimming … Read more

echo vs output variable [closed]

I believe this topic was addressed quite thoroughly here. I might add that within the WordPress community it is common syntax practice to default to echoing tags with an option or alternative/interior function to return the result instead. This I believe is driven by the level of code experience the average user within WordPress has … Read more

Customise Author Page?

You will need something like this in your author.php file. Taken from the Codex. http://codex.wordpress.org/Author_Templates <?php get_header(); ?> <div id=”content” class=”narrowcolumn”> <!– This sets the $curauth variable –> <?php $curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author)); ?> <h2>About: <?php echo $curauth->nickname; ?></h2> <dl> <dt>Website</dt> <dd><a href=”https://wordpress.stackexchange.com/questions/157033/<?php echo $curauth->user_url; ?>”><?php echo $curauth->user_url; ?></a></dd> <dt>Profile</dt> <dd><?php … Read more

Like/Dislike plugin crawler problem

The problem is your definition of a vote as any access to a specific url. Your definition should include both an access and some not trivial info a bot will not have, for example an authentication cookie (i.e., the user has to be logged-in).

Strict Standards: Non-static method in sidebar generator

There’s not a huge amount you can do about this. Many developers turn off strict errors, as they are pervasive (there are even some in core). Of course it could be fixed – but then what? It’s a plugin, so the next time you update that plugin, your changes will be overwritten.

Change an option string to a function [closed]

To do something like that, you would most likely have to use eval() on the text provided … which is a really bad idea. You would be much better off providing a list of check boxes that have different values so the user can choose which items to show your sidebar on. For example: <input … Read more

get_avatar from user id

To display users with specific ID’s on a page you’ll need to run a WP_User_Query, either by placing the following code in your functions.php and calling it with a shortcode or adding it to the page template: //Replace the numbers 1, 2 with the user ID’s to return $args = array( ‘include’ => array( 1, … Read more