SmartCrawl] Expand Macros

I would like to know how to use the expand function in the Macros for SmartCrawl. class_wds_macro.php has a function called expand, I just don’t know how I can call that in my function.php to use it. I could not find anything in the documentation about that. I would like to add a macro called %%metroarea%% in the meta descriptions for pages. Please advice.

  • Predrag Dubajic
    • Support

    Hi Jonie,

    In order to expand macros it would be best to try with using wds_metadesc filter and inject additional content that way.

    You can see how the filter is used if you check wp-content/plugins/wpmu-dev-seo/includes/tools/onpage.php on line 584.

    Hope this helps to get you started and let us know if you have any followup questions.

    Best regards,

    Predrag

  • Jonie
    • New Recruit

    This only works for the title and description. The values for twitter and facebook cards are pulling the content with the macro code instead of the value – please see screenshot.

    This is the code that i added in functions.php

    function puroclean_meta_macros( $meta ) {

    // replace %%metroname%% macro in description

    $metroname = puroclean_get_metroname();

    $meta = str_replace( '%%metroname%%', $metroname, $meta );

    return $meta;

    }

    add_filter( 'wds_metadesc', puroclean_meta_macros, 10, 1 );

    add_filter( 'wds_title', puroclean_meta_macros, 10, 1 );

    [attachments are only viewable by logged-in members]

  • Predrag Dubajic
    • Support

    Hi Jonie,

    To be honest I’m not sure if we could do the same thing for Twitter and Facebook so I have forwarded your ticket to our dev guys to check it out and see what could we do here.

    Please note that developer response might be slower than usual staff response, so we appreciate your patience on this.

    Best regards,

    Predrag

  • Predrag Dubajic
    • Support

    Hi Jonie,

    Apologies for the delay here, I was discussing this further with the developers and I’m afraid that this is currently not possible as there are no filters to be used.

    They are however working on the expendable macros list for future versions where this will be doable.

    Best regards,

    Predrag

  • Ari
    • Recruit

    Hey Jonie

    About wds_title & wds_metadesc filters, yeah these are not work for twitter and facebook, I just fixed it and forwarded to our plugin developers, so they have a review for future release.

    Please unzip the attached zip file and replace with plugins/wpmu-dev-seo/includes/tools/onpage.php file.

    It works for me in my test sites!

    Best Regards,

    Ari