Fix My Custom Function: Remove Automatic

If I’m understanding your question correctly, I think adding remove_filter( ‘the_excerpt’, ‘wpautop’ ); around when you have add_filter(‘excerpt_length’, ‘Excerpt::new_length’); does what you’re looking for.

Having problems loading Jquery in functions.php

You have multiple errors here. You’re including CSS and JS on the same and wrong hook For JS you could use wp_enqueue_scripts For CSS you could use wp_print_styles wp_register_script / wp_enqueue_script only accepts 4 parameters. You should only register your scripts and enqueue only the last one with its dependencies. Use the third parameter to … Read more

Including inline Custom Fields info with add_filter in functions.php

You are trying to echo within a variable. You also have encapsulated PHP tags in the string as well. You need to concatenate just the functions themselves like this: function default_content($content) { global $post; if ($post->post_type == ‘my-custom-post-type’) { $content .= ‘<p style=”text-align: center;”><strong>Custom Field Text here: ‘. get_post_meta( $post->ID, “custom-field-1”, true ).'</strong></p> <p style=”text-align: … Read more

Showing author box on post detail page

Where is your code for the author appearing (what files > category / post / single?)? I would guess you have the author code within either a category or post template file, simply add the author code to the single template file (create single.php if you don’t have one) and remove from the upper level … Read more

Shortcode Variations?

function btn($atts, $content = null) { extract(shortcode_atts(array(‘link’ => ‘#’, ‘color’ => ‘teal’ , ‘size’ => ‘large’), $atts)); return ‘<a class=”btn ‘.$size.'” href=”‘.$link.'” style=”background:’.$color.’;”><span>’ . do_shortcode($content) . ‘</span></a>’; } With that function you get by default color teal and size large. I suppose that for size you are using classess and for color just background. If … Read more

Adding a filter to my posts

The excerpt must be used by the Theme. I don’t think it is. Use ‘the_content’ filter to append to the post. Excerpts are usually used in feeds and only by certain themes. add_filter(‘the_content’, function($content){ if(!is_archive()) return $content; global $post; // This is the current output post ob_start(); // Echo stuff to append to post here! … Read more

Why does this fail: Disabling plugins enqueue_script() in functions.php

You have two issues here: Conditional tags (is_single()) should not be used so early in functions.php. Your removal function is getting hooked to run after function it’s meant to remove. It should be something like this: function remove_shc() { if ( is_single( array( 17, 19, 1, 11 ) ) ) remove_action( ‘wp_print_scripts’, ‘wp_shc_head_scripts’ ); } … Read more

Error on Include php:/usr/share/pear

Would it not make more sense to use get_template_part() ? What may be happening is that there is no 404 template: if ( ” != get_query_template( ‘404’ ) ) include( get_query_template( ‘404’ ) ); http://codex.wordpress.org/Function_Reference/get_query_template This may be because pretty permalinks have been turned off, or because there is no 404 page template to be … Read more

How to call a specific value within the functions.php file?

function youtube($atts) { global $post; $value = get_post_meta($post->ID, ‘video_link’, true); extract(shortcode_atts(array( //Make sure not to include the ‘value’ as part of this array. “width” => ‘475’, “height” => ‘350’, “name”=> ‘movie’, “allowFullScreen” => ‘true’, “allowScriptAccess”=>’always’, ), $atts)); return ‘<object style=”height: ‘.$height.’px; width: ‘.$width.’px”><param name=”‘.$name.'” value=”‘.$value.'”><param name=”allowFullScreen” value=”‘.$allowFullScreen.'”></param><param name=”allowScriptAccess” value=”‘.$allowScriptAccess.'”></param><embed src=”‘.$value.'” type=”application/x-shockwave-flash” allowfullscreen=”‘.$allowFullScreen.'” allowScriptAccess=”‘.$allowScriptAccess.'” width=”‘.$width.'” height=”‘.$height.'”></embed></object>’; … Read more