• Resolved roam92

    (@roam92)


    Greetings,

    I’m new to your plugin and noticed that it has integration with the All in One SEO Pack. Does it support other SEO plugins as well, like Yoast?

    What I’d like to do is continue having each post’s title be the <title> tag for its page, but then have an optional secondary title which can be set individually to be the separate <H1> heading for the page.

    Is that something that this plugin can easily do? Is any coding required?

    Thanks very much!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author thaikolja

    (@thaikolja)

    Hi,

    You can use secondary titles in Yoast by using %%cf__secondary_title%%. Please note the underscore _ after the cf_. Here’s more info:

    https://metabox.io/add-custom-fields-to-yoast-seo-meta-tags/

    Or, if you use the premium version of Yoast, have a look here:

    https://yoast.com/help/add-custom-fields-to-yoast-seo-premium-plugin-settings/

    I hope this helps! Let me know if there’s anything else I can do for you. And if you’re happy, I’m always happy about a positive review πŸ™‚

    Thanks for using Secondary Title.

    Thread Starter roam92

    (@roam92)

    Hi @thaikolja

    Thanks so much for your fast response. That is extremely helpful!

    What would I need to do to get the secondary_title by itself (if it exists) into each post’s <H1> heading – while having the post’s main title remain as the <title> tag for the page?

    In other words, I don’t want the two titles merged… I would like:

    Individual post or page titles β€”> <title> tag
    Secondary Title field (if present) β€”> <H1> heading

    Can I do this with Yoast custom variables? Or outside of Yoast?

    Do I need to modify my theme template, or can I use filters or hooks with a code snippet?

    Sorry, trying to sort this out… Your plugin looks great and I’m very happy to leave a review and donate to support it. Just trying to figure out how to accomplish what I need.

    Thanks again!

    Thread Starter roam92

    (@roam92)

    Follow-up: I think I might have figured it out…

    I turned off “Auto show:” in the Secondary Title plugin settings. Then, is adding a code snippet like this what I need?

    function get_title_for_h1( $title ) {
    	if ( is_singular() && has_secondary_title() ) {
    		$title = get_secondary_title();
    	}
    
    	return $title;
    }
    add_filter( 'the_title', 'get_title_for_h1' );

    It seems to work on any WordPress, regardless or independent of Yoast.

    Thread Starter roam92

    (@roam92)

    Hi @thaikolja, any thoughts? I’m guessing there should also be a check for in_the_loop() in the conditional clause above… would you agree?

    Also, this feature might be a nice option to add to your plugin – what do you think?

    In fact, it’s what I originally thought the plugin did! Here’s why:

    Main Titles: Taking Good Care of Your Titles

    Secondary Titles: How It Should Be Done

    [recommendations from Greg Mulhauser, the author of Greg’s High Performance SEO]

    Anyway, the simple code above is different (and better) than how Yoast uses an additional title… A SEO plugin like Yoast isn’t even used with this approach.

    Plugin Author thaikolja

    (@thaikolja)

    Hi,

    Yes, the “Auto show” option was exactly for cases like this where one might want to change the way Secondary Title works. The in_the_loop() feature is already built-in; I called it “Only show in main post”. It won’t do anything, obviously, if you’re not using “Auto show”, but if you want Secondary Title in to “listen” to the settings in PHP (following the visibility rules, the ID limits, and other options found on the settings page), you can pass the use_settings parameter in get_secondary_title($post_id, $before, $after, $use_settings).

    Check the documentation for more details.

    Not all SEO plugins work the same, that’s why it’s difficult to give you a straight answer here that works for all. Secondary Title has quite a few filter hooks that allow you to hook into the output and functionalities of the plugin so you have total control over it and use it in other hooks, just like in your example above. You have to play around a bit to see what works best with your theme and SEO plugin. Unfortunately, there’s no universal answer for everything.

    If you have questions, feel free to ask, I’m always happy to help where I can. Criticism is also welcome.

    Thread Starter roam92

    (@roam92)

    Thanks so much for your detailed response. I think I understand – you’re saying I could add the use_settings boolean parameter to my calls if I want to use the settings specified on the plugin’s configuration page. (Although, I noticed that has_secondary_title() does not offer the optional use_settings parameter.)

    My big question really is: can the Secondary Titles plugin (out of the box) accomplish the following use case without adding the custom code?

    Individual post or page titles β€”> Main <title> tag
    Secondary Title field (if present) β€”> <H1> heading

    As far as I could tell, I could not accomplish this using any current settings with “Auto show” or otherwise.

    So do you think the plugin should or could offer this option? It would be simple to add using code similar to what I posted above – and I think including that would be a valuable feature addition to the plugin. And it would work on all platforms, either with or without a SEO plugin. What do you think?

    Thanks again!

    Plugin Author thaikolja

    (@thaikolja)

    Yep, that’s what I meant by use_settings.

    Thanks for your suggestion, but my philosophy is to keep things simple. I prefer to keep Secondary Title as easy as possible. Even with an option like the one you described, it’d be up to the theme eventually. Because the theme has the final say on how the <title> tag is being used and how post titles are being displayed. That’s why I offer the option to turn off “Auto show”; users then can use the plugin in a lot more flexible way.

    I appreciate your suggestion and that you’re taking the time to think about how to improve Secondary Title, but I think it’d only make things more complicated if I introduce features like this. The last thing I want is to take away the user’s (and developer’s) freedom to use the plugin in the way they see fit. And there will never be a way to make 100% of all users happy — sooner or later a few of them need to add a few lines of custom code, and when it comes to that, I’m here to help πŸ™‚

    Does that make sense?

    Thread Starter roam92

    (@roam92)

    Thanks, that does make some sense to avoid feature creep if it’s something that you think is unusual.

    I took another look at the plugin settings and think I might have found a solution, if there is slight improvement to “Post types:” selection.

    I set “Auto show:” to On, and then set “Title format:” to just %secondary_title% by itself.

    Then that achieves the goal of having %title% as the <title> tag for posts & pages, with %secondary_title% as the H1 heading.

    However, my difficulty then is with the Index (home) and Archive pages… These still show the %secondary_title% instead of the main %title%. In other words, I need to not use the secondary title on those types of WordPress pages.

    Do you think you can possibly add a third checkbox to the “Post types:” setting for Lists of articles? (home, archive, category pages, etc.) That way, I could exclude those.

    I think this makes sense for completeness, and would extend the flexibility of the plugin for everyone.

    Plugin Author thaikolja

    (@thaikolja)

    I’m sorry, I don’t see the benefit there, I can’t imagine that many people would need a feature like this πŸ™

    But if it’s for your case only, I could give you a PHP snippet that does what you’d like to have. But for that, I need a brief explanation of what it is you want to achieve because I don’t get it 100% from your posts (sorry).

    Thread Starter roam92

    (@roam92)

    Thanks, but I already have the solution in place for myself. It’s the code snippet I posted above. It enables the plugin to accomplish the goal.

    I was simply trying to help broaden the plugin to become useful in more cases and to more people.

    What I’m talking about is not merging the two titles, though of course some folks may want or need that. Instead, the secondary title (if present) displays as an alternate title for the post in the H1 header.

    Why is that? Well, the use case is best explained here:

    Secondary Titles: How It Should Be Done

    In other words, it’s primarily for improving SEO, either with or without a SEO-specific plugin. (And it’s different and better than how the “SEO Title” works in Yoast.)

    Lastly, to me, it makes sense that if the plugin can control display of the secondary title on either posts or pages, it should also be able to control it on archive/index pages as well.

    Hence the suggestion, which would make the goal possible without custom coding.

    Thanks again.

    Plugin Author thaikolja

    (@thaikolja)

    Thanks again, I really appreciate your input. But I don’t think there will be a user base for a feature like this. After all, Secondary Title is not really a plugin for SEO, it’s to provide an alternative title. And if the features that come out of the box aren’t enough, users have the ability to achieve their goal with a few lines of custom code, and I’m always happy to assist with that.

    Thread Starter roam92

    (@roam92)

    After all, Secondary Title is a plugin … to provide an alternative title.

    That’s exactly what I’m talking about.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Support for SEO plugins?’ is closed to new replies.