Removing unneccessary p-tags (Not every p)

If what you want is really only to prevent WordPress from adding empty <p></p> and you’d be happy with removing those after post retrieval from the database, then function wpse108194_remove_empty_paragraphs( $content ) { $content = preg_replace( ‘#<p>\s*</p>#’, ”, $content ); return $content; } add_filter( ‘the_content’, ‘wpse108194_remove_empty_paragraphs’, 11 ); will do.

Using More Tag in Combination with the_excerpt

first of all you don’t need to echo the_content(); and the_excerpt(); both methods already echod, second simply put the more link using permalink after the_excerpt(); like this. <?php // IN X USER GROUP if($customgroup==1 || // Are they in the custom group? $userinfo->usergroup == 66) { // or the admin of the website? the_content(); } … Read more

Putting PHP variables into javascript [duplicate]

Use wp_localize_script: wp_enqueue_script(‘YOUR_SCRIPT_HANDLE’); $object = array( ‘zoom’ => get_option(‘map_zoom’), ‘longitude’ => get_option(‘map_longitude’), ‘latitude’ => get_option(‘map_latitude’), ); wp_localize_script(‘YOUR_SCRIPT_HANDLE’, ‘JSObject’, $object); And then use it in your JS file like JSObject.zoom and the like.

esc_url returns incorrect URL

It ended up being something very easy, but something I overlooked. Since I always use <?php get_search_form(); ?> for my search forms, I naturally assume that in my section template for the search area, I was using that, but I was not. I built the theme custom off of another theme I built for a … Read more

Prevent Indexing of 404 Page

This won’t ever return true: if ( is_single( ‘404.php’ ) ) {} The is_single() conditional only returns true in a single blog post context. The parameter it accepts is a post ID, slug, or title. The 404.php file is a template file, not a post. Use is_404() instead: if ( is_404() ) {}

Vagrantpress + composer

Unfortunately you can’t use Vagrantpress and Composer directly together easily. Half of Vagrantpress is the WordPress setup itself which isn’t compatible. If you still wanted to leverage the base work Vagrantpress has done with PHP, Apache, MySQL etc, you could fork it and modify their WP module found here: https://github.com/chad-thompson/vagrantpress/blob/master/puppet/modules/wordpress/manifests/init.pp It would still require a … Read more

Woocommerce Attributes pulling in wrong data

You are confusing get_terms() with get_the_terms() get_terms() returns an array all the terms in a taxonomy. get_the_terms() returns an array of all the terms for a particular post. global $post; $terms = get_the_terms( $post->ID, ‘pa_size’); foreach ( $terms as $term ) { echo “<li>” .$term->name. “</li>”; } You might also like get_the_term_list() which would be … Read more