WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] Tags for custom taxonomies? (28 posts)

  1. pkiula
    Member
    Posted 2 years ago #

    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/

  2. brasofilo
    Member
    Posted 2 years ago #

    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 :)

  3. brasofilo
    Member
    Posted 2 years ago #

    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

  4. pkiula
    Member
    Posted 2 years ago #

    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

  5. brasofilo
    Member
    Posted 2 years ago #

    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'

  6. brasofilo
    Member
    Posted 2 years ago #

    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 :)

  7. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

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

  8. pkiula
    Member
    Posted 2 years ago #

    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.

  9. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  10. pkiula
    Member
    Posted 2 years ago #

    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?

  11. brasofilo
    Member
    Posted 2 years ago #

    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?

  12. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

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

  13. kletskater
    Member
    Posted 2 years ago #

    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;-)

  14. brasofilo
    Member
    Posted 2 years ago #

  15. pkiula
    Member
    Posted 2 years ago #

    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.

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

  17. pkiula
    Member
    Posted 2 years ago #

    Thanks ipstenu. I tried creating a new CPT using the fantastic Types plugin.

    Then I created a couple of articles inside that CPT, to test.

    Then I created the WP SEO "Titles" for that Custom Post Type articles and Custom Post Type Archive. Just to test what values show up, I used this tag format:

    %%title%% | %%category%% | %%sitename%% | %%sitedesc%%

    This does not seem to be working. The title is still this for my CPT called "Campaigns" --

    The Title Here - SiteName

    This is the template that is in my main WP settings, not in the Title formatting in WP SEO. So it's not really picking up from WP-SEO plugin.

    What am I missing?

    Appreciate any pointers.

  18. kletskater
    Member
    Posted 2 years ago #

    @ pkiula,
    You are right, of course, this is an English forum.
    hence here the translation (with google translate)
    Joost, I assume that these attracts do not bother you..
    Some people forget that there is life after wordpress.

    keep up the good work;-)
    I will continue read this topic, for it is very instructive for me.

  19. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    pkiula, there is no tag, there are filters, like wpseo_title, that you can use to do this yourself.

  20. pkiula
    Member
    Posted 2 years ago #

    Thanks. Any usage examples?

  21. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    No.

  22. pkiula
    Member
    Posted 2 years ago #

    Then I suppose there is indeed room for you to include that feature for anyone who uses WordPress for more than just a regular blog, which will be a lot of people (if not most of them) in the near future. I'll be watching the next update. This is a great plugin and your effort is appreciated. But it's not serving my purpose of rewriting titles even with the standard WordPress functionality today which includes CPT.

    Thanks for responding here.

    Appreciate brasilo's code too. It's useful. But that is not the approach I will take. Will wait for a proper update to the plugin.

    Thanks all. Hopefully there are feature ideas here which you will focus on instead of the knee jerk bile up there as a distraction.

  23. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    pkiula: i still don't appreciate your tone of voice one bit.

  24. pkiula
    Member
    Posted 2 years ago #

    You don't have to. Just add the feature to your plugin if you hear what a user is telling you. And if feedback makes you break out in dance the find another thing to do. I have repeated twice that I appreciate your work, as I am sure a gazillion people who use it too, but I cannot mollycoddle you just because you wrote some code. I'd pay for a pro version with the feature discussed here. Up to you what you want to do with it. Good luck and thanks for the work.

  25. brasofilo
    Member
    Posted 2 years ago #

    pkiula, this is really an unfortunate display of entitlement...

    And I've seen that you treated other plugin authors too as if they owed you something. Needless to say, they don't.

    Please, don't fall for the myth that customers (and kids) are sacred creatures that deserve everything. But on this matter, I'll let the great philosopher and stand up comedian, George Carlin, do the talk for me.

    It's also worth reminding that what we write here and now, may very well survive for hundreds of years. At least, future generations can learn from the mistakes of this one.

    Peace and respect,
    Rodolfo

    (mods: i'm voting for kindly close this thread)

  26. kletskater
    Member
    Posted 2 years ago #

    @ brasofio: Amen

  27. weller33
    Member
    Posted 1 year ago #

    I'm using shopperpress theme and am desperately trying to pull in the parent category to use in the title tag.. would this work for my fix? The main problem I have is identifying the Parent Category so the variable fetches what I need?

    wp-admin/admin.php?page=wpseo_titles&settings-updated=true#top#template_help -
    this is ideally what I'm looking for..

    %%term_title%% %%page%% %%category_parents%% %%sep%% %%sitename%%

    I know I will probably need to set up an ID for it like so in wordpress-seo/inc/wpseo-functions.php:
    '%%category_parents%%' => wpseo_get_terms( $r->ID, 'category_parents' ),

    but where and what would I add it so it can get..?

    any help much appreciated!

  28. Simplii Web
    Member
    Posted 1 year ago #

    I would also to see this feature working with WP-Ecommerce categories. Any updates on this yet?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic