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

Instantiate class to be available to all plugin functions

Ryan McCue had a nice idea for his plugin Hopper: add a callback for a custom filter to return the current instance. Sample code for the plugin: class Plugin_Class { public function __construct() { add_filter( ‘get_plugin_class’, array ( $this, ‘provide_instance’ ) ); } function provide_instance() { return $this; } } In a theme or a … Read more