Forum Replies Created

Viewing 15 replies - 16 through 30 (of 80 total)
  • Plugin Author Steve

    (@stvwhtly)

    Hi,

    I’ve installed the WP SEO plugin mentioned and copied the snippet I wrote into the themes functions.php file (in this case TwentyTwelve), however it worked as expected for my tests.

    One small modification I would suggest is to remove any markup / tags using the following:

    add_filter( 'wpseo_metadesc', function( $description ) {
    	global $post;
    	if ( $subheading = get_post_meta( $post->ID, '_subheading', true ) ) {
    		return $subheading;
    	}
    	return $description;
    } );

    The issue you are having may be related to PHP versions, one thing I can suggest is removing the anonymous function used:

    function wpseo_metadesc_subheading( $description ) {
    	global $post;
    	if ( $subheading = get_post_meta( $post->ID, '_subheading', true ) ) {
    		return $subheading;
    	}
    	return $description;
    }
    add_filter( 'wpseo_metadesc', 'wpseo_metadesc_subheading' );

    As the theme functions file is included in the admin, any error introduced to the file will cause the 500 error you are seeing. With debugging and error outputting enabled it would probably show the actual error in more detail.

    Forum: Plugins
    In reply to: [SubHeading] length limit?
    Plugin Author Steve

    (@stvwhtly)

    Hi,

    OK, not to worry – let’s try and solve this one.

    It could be and issue with PHP versions, the method used in the snippet (anonymous function) will only work in PHP 5.3 of greater.

    First option would be to check which version you are using, and then replace what you have with this alternative.

    function trim_subheading( $value ) {
        return wp_trim_words( $value, 5 );
    }
    add_filter( 'subheading', 'trim_subheading' );

    If this isn’t the problem we can move on to something else.

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    Instead of changing the tag value, I’d suggest altering the meta_key value defined in the constructor:

    $this->meta_key = '_' . $this->tag;

    Modifying this value instead should keep the plugin functioning as expected, but store the values with a different post_meta key:

    $this->meta_key = '_' . $this->tag . '_plugin';

    This would use the key _subheading_plugin instead of _subheading.

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    This should be possible to adjust by editing the content-single.php file and adding the manual call to the function instead of using the “Automatically display subheadings before post content.” option.

    If you find the current h1 tag, simply add the subheading call after that, such as:

    ...
    <h1 class="entry-title"><?php the_title(); ?></h1>
    
    <?php if (function_exists('the_subheading')) { the_subheading('<p>', '</p>'); } ?>
    ...

    This should guide you in the rough direction of where to look and what to do, hope it helps.

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    Although untested, it should be possible to add the subheading to the excerpt via the improved_trim_excerpt function:

    function improved_trim_excerpt($text) {
    	global $post;
    	if ( '' == $text ) {
    		...
    	}
    	$text = get_the_subheading( $post->ID, '<p>', '</p>' ) . $text;
    	return $text;
    }

    This would wrap the subheading in <p> tags and output it before the excerpt.

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    Although unfamiliar with the WordPress SEO plugin in question, I have spotted that it makes use of a number of filters therefore it should be possible to do ask you require.

    Something like this may work to output the subheading as the meta description if one is set, otherwise use the default.

    add_filter( 'wpseo_metadesc', function( $description ) {
    	global $post;
    	if ( $subheading = get_post_meta( $post->ID, '_subheading', true ) ) {
    		return $subheading;
    	}
    	return $description;
    } );

    Note that I’ve not testing that it actually works.

    You could try adding this to your theme functions.php file and see if it makes any difference.

    Reference: See line 869 https://plugins.trac.www.ads-software.com/browser/wordpress-seo/trunk/frontend/class-frontend.php

    Hope this points you in the right direction.

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    This seems slightly odd, I installed the Montezuma theme directly from the theme directory and added the following immediately after the closing </h1> tag in single.php:

    <?php echo the_subheading(); ?>

    This seemed to work as expected and outputted the subheading assigned to the post.

    Does this differ from what you have tried?

    Plugin Author Steve

    (@stvwhtly)

    Apologies, there was an issue with regards to the upgrade process between versions prior to 1.6.

    Deactivating and Activating the plugin again seems to be the common solution until now, along with adjusting the settings.

    Hopefully this has since been resolved in 1.7.1.

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    Is it possible to push you for some further information?

    1. What is the value you are trying to enter as subheading text?
    2. Which options do you have set on the admin settings page?
    3. What post type are you trying to add the subheading to?
    4. What user permissions does your user have? (admin, editor etc)

    Thanks.

    Forum: Plugins
    In reply to: [SubHeading] length limit?
    Plugin Author Steve

    (@stvwhtly)

    Hi,

    As of the recently committed version 1.7.1, it is possible to limit the subheading displayed using the new subheading filter.

    For example, the following can be added to your theme functions.php file to limit the subheading to 5 words.

    add_filter( 'subheading', function( $value ) {
        return wp_trim_words( $value, 5 );
    } );

    If you require an exact number of characters, simply change the contents of the filter to manipulate the output to the desired format.

    Hope this helps.

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    Referring back to the WordPress documentation, it looks as though I may have including some slightly incorrect / misleading information in the Frequently Asked Questions relating to this topic.

    It should be possible to adjust your snippet to use ‘class’ as an array key rather than value, therefore something along the lines of this should help:

    add_filter( 'subheading_tags', function( $tags ) {
     	$tags['span'] = array('class' => array());
     	$tags['br'] = array();
        return $tags;
    } );

    I have also adjusted the readme file for the next release to reflect this – hope it helps.

    – Steve

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    I can confirm it is working in my installations of 3.5 and 3.5.1.

    Can you provide some details as to the integration method you are using and the options defined?

    Thanks.

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    No worries on the “Hijack” ??

    There is a todo list, which is getting slightly longer ever time I look at it, however I intend to dedicate some time towards the end of this week.

    If I can fit in your requests they will appear in the next update.

    Thanks for your feedback.

    – Steve

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    There is a hidden input in the form used on manage.php called “post_type”.

    If you change this from “page” to “mycustomposttype” this issue should be resolved.

    – Steve

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    There is currently only instruction within the readme file, however I have noted this feedback and intend to add more help to the management page to explain the integration process further.

    Thanks,

    – Steve

Viewing 15 replies - 16 through 30 (of 80 total)