• Resolved gazpachu

    (@gazpachu)


    It’s not working. Located in functions.php:

    add_filter('ghpseo_output', 'my_seo_output', 10, 2); 
    
    function my_seo_output($output='', $type='main') {
    
    	echo "hello";
    
        switch ($type) {
            //case "main": $result = $output; break;
            //case "main_title": $result = $output; break;
            //case "secondary_title": $result = $output; break;
            case "description": if( is_single() ) {
    								$standfirst = get_post_meta($wp_query->post->ID,'subtitle',true);
    								$result = '<meta name="description" content="' . $standfirst . '" />';
    
    							} else {
    								$result = $output;
    							}
    							break;
            default: $result = $output;
            }
        return $result;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter gazpachu

    (@gazpachu)

    I’ve placed the function calls in the header like this:

    <?php if (function_exists('ghpseo_output')) ghpseo_output('description'); ?>

    I’ve enabled the “Enable Output Modifications?” checkbox.

    The function is now triggered but it doesn’t enter in the “description” case.

    What am I missing?

    Thread Starter gazpachu

    (@gazpachu)

    Not working ??

    Greg, please help me.

    Thanks

    Plugin Contributor gregmulhauser

    (@gregmulhauser)

    I would recommend reading the ‘Instructions’ tab of GHPSEO, where you’ll find details on filtering the GHPSEO output function. By filtering the GHPSEO output function, you are not filtering anything else except that function — in particular, you are not filtering the head meta description. If you’d like to filter the head meta description, you’d need to remove the plugin’s built-in wp_head action ‘head_desc’ and provide one of your own instead (which could of course use the filterable GHPSEO output function).

    All the best,
    Greg

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filter not getting triggered’ is closed to new replies.