WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: WordPress SEO by Yoast] Tags for custom taxonomies?

[Resolved] [Plugin: WordPress SEO by Yoast] Tags for custom taxonomies?

  • Hi. Love this plugin. More than just a regular SEO plugin.

    One problem. I use Jigoshop for ecommerce. The post_type is product, and in there the category is called product_cat.

    For the WPSEO equivalent for the titles, I’ve tried:

    1. %%product_cat%%
    2. %%product_category%%
    3. %%productcat%%
    4. %%productcategory%%

    …etc. But none of them work. It always ends up with an empty space.

    Any pointers or ideas?

    Thanks!

    http://wordpress.org/extend/plugins/wordpress-seo/

Viewing 15 replies - 1 through 15 (of 27 total)
  • I’ve just met the same problem today and gone through great lengths trying to find an answer/solution, but I’m afraid there’s none…

    The equivalents you are trying don’t work because there’s no provision for something like that in the plugin code.

    I managed to make %%my_post_type_category%% work hacking one line of the plugin, and adding a custom function inside the theme’s functions.php.
    – here’s the code with instructions: http://pastebin.com/SSgCDrex

    But, while I was writing this post, I had an interesting idea that works without hacks:
    – in each custom post, make a Custom Field with the desired category, i.e., my_cf_category
    – in the SEO Titles use %%cf_my_cf_category%%
    – voilà!

    And for a final touch, we need a function that would automate the creation of the Custom Field based on the current Custom Categories. But that’s a job for a second chapter 🙂

    Looks like the second chapter came earlier than expected!
    & don’t hack the plugin folks, it’s not worthy…

    Anyway, I’ve just changed the previous pastebin with a Workaround to use Custom Taxonomies in WordPress SEO titles. It will automatically create/update a Custom Field to be used as a SEO Title.

    The code is fully commented, adapt to your needs and start using %%cf_your_custom_category%% in your Titles.

    The URL is the same: http://pastebin.com/SSgCDrex

    Thanks a lot brasofilo. Just to confirm

    1. This will also work with older entries? Or just new entries?

    2. Also, which part of the code is hardcoded and needs to be changed? I see the word “movies” in there. Do I need to replace it with my custom taxonomy name?

    Thanks

    pkiula,
    as a matter of fact, no, it’s only works when saving/updating…

    I will check for a workaround (maybe a bulk update will do the job), otherwise I’ll build a function that does that.

    I changed the comment in line 25 to explicit what need to be changed. That are:
    ‘movie’
    ‘category’
    ‘my_cat_title’

    Ok, it’s just a matter of doing a bulk update.
    For example, set the same author as before and hit save, all the CF will be created.

    I made a small modification in the code. When a CF is declared with an underscore at the beginning of its name, it doesn’t show up in the post editing screen.

    We are handling its value automatically, so there’s no need to display it in the admin interface.

    So, when using it in SEO the correct value is %%cf__my_category_custom_field%%.
    With double underscore after %%cf.

    ps.: mark this topic as resolved if this solution works for you 🙂

    Plugin Author Joost de Valk

    @joostdevalk

    Might add a feature in the plugin to do this later, but currently this is the way to go indeed!

    Thanks Joost. I’ll leave WP SEO for the general blog bits, but for any serious site using custom types, this is a huge room for improvement.

    Plugin Author Joost de Valk

    @joostdevalk

    I’m sorry but that’s quite an offensive statement. I use it for custom post types ALL the time. Just because your particular use case doesn’t work yet doesn’t mean there’s “huge” room for improvement.

    Dude. Chill. The idea is not to offend. If custom types are supported then please let me know how the custom type for my use case can be supported. What’s the tag code I should use?

    For potato sake, I just posted a solution that you simply have to adapt 3 words and drop into your functions.php (free support). The author of this great (and also free) plugin just said that “this is the way to go”…
    Shall we take you by the hand and reassure you that the world is not so scary after all?

    Plugin Author Joost de Valk

    @joostdevalk

    Hehehe thanks brasofilo, and pkiula, telling me to chill can lead to really strange results at times 😉

    Joost, ik neem aan dat je je er niks van aantrekt..
    Sommige mensen vergeten dat er een leven na wordpress is.

    keep up the good work;-)

    Not sure what the message for “other visitors” is for when my own question is still unanswered.

    Those thread you shared the URL for suggest that a plugin should be written for this type of functionality, not to make theme-specific edits via functions.php.

    My question for Joost is simple, which I hope someone can respond to in English: given that Joost says he has used this successfully and without problems with custom post types before, I understand that there must be a tag format for this that is undocumented. Please let me know what the tag format is.

    Thanks so much.

    Does it work on NON jigoshop CPTs? There’s a possibility you have a conflict between two products.

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘[Resolved] [Plugin: WordPress SEO by Yoast] Tags for custom taxonomies?’ is closed to new replies.