Support » Plugin: Events Made Easy » meta tags from Yoast SEO

  • Resolved Ambyomoron

    (@josiah-s-carberry)


    I am using the Yoast SEO plugin, which generates meta tags in the event page header. What I cannot understand is how Yoast find the following tag:

    <meta property="og:description" content="This page is used by Events Made Easy. Don’t change it, don’t use it in your menu’s, don’t delete it. Just make sure the EME setting called ‘Events page’ points to this page. EME uses this page to render any and all events, locations, bookings, maps, … anything. If you do want to delete this &hellip;" />

    The description is hard coded in EME. How does Yoast find it?

    In any case, most of the meta tags are wrong. I know how to generate the tags I want using EME, but I do not know how to eliminate the erroneous tags from Yoast (short of disabling Yoast, which is not an option).

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Franky

    (@liedekef)

    Google for “yoast disable og description” helps you find the answer. E.g.:
    hhttps://kb.yoast.com/kb/getting-open-graph-for-your-articles/

    Ambyomoron

    (@josiah-s-carberry)

    Yoast allows you to enable or disable Opengraph or Twitter meta tags on an all or nothing basis. I want to keep them for everything but the events managed by EME. Furthermore, Yoast’s capability to edit the settings on a page by page basis is not useful, because Yoast functionality does not appear on the EME pages used to edit events. So, unfortunately, that suggestion does nothing to resolve the problem

    Plugin Author Franky

    (@liedekef)

    You can also create your filter for yoast, check out the wpseo_og_* filters. Inside that filter, check if you’re on a single event using is_single_event_page() and/or is_single_location_page, or more globally, eme_is_events_page()

    Ambyomoron

    (@josiah-s-carberry)

    Yes, that helps me. Thanks very much.

    I am a little unsure of how to proceed, though. I understand that I can add functions to my theme’s functions.php and thus leave plugin code unchanged, in case of upgrades. But I am not sure about replacing existing functions. It seems to me that the simplest approach is to replace Yoast’s og_tag function, adding the test you suggest, eme_is_events_page(). Can I just add a new function with the same name in functions.php or does WordPress require a completely different approach?

    Plugin Author Franky

    (@liedekef)

    Never change code, nor replace functions, the filters are there for that. Just create a child theme of your theme and add the needed filters to the functions.php there. If you don’t know how to work with wordpress filters, this is an example in EME: http://www.e-dynamics.be/wordpress/category/documentation/12-hooks-and-filters/
    For yoast I refer you to the yoast doc.

    Ambyomoron

    (@josiah-s-carberry)

    Here is what you can add to functions.php to remove the erroneous Opengraph and Twitter tags created by Yoast for events created using EME:

    add_action('wp_head', 'remove_all_wpseo_og', 1);
    function remove_all_wpseo_og() {
    	if ( eme_is_events_page() ) {
    		remove_action( 'wpseo_head', array( $GLOBALS['wpseo_og'], 'opengraph' ), 30 );
    	}
    }
    
    add_action('wp_head', 'remove_all_wpseo_twitter', 1);
    function remove_all_wpseo_twitter() {
    	if ( eme_is_events_page() ) {
    		remove_action( 'wpseo_head' , array( 'WPSEO_Twitter' , 'get_instance' ) , 40 );
    	}
    }

    The correct data can be added at EME | Settings | Other | Extra event html headers such as:

    <meta property="og:type" content="event" />
    <meta property="og:title" content="#_NAME"/>
    <meta property="og:url" content="#_EVENTPAGEURL"/>
    <meta property="og:image" content="#_EVENTIMAGEURL"/>
    <meta property="og:description" content="#_EXCERPT" />
    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:description" content="#_EXCERPT" />
    <meta name="twitter:title" content="Whatever title you want" />
    <meta name="twitter:site" content="@yourtwittername" />
    <meta name="twitter:creator" content="@yourtwittername" />
    Plugin Author Franky

    (@liedekef)

    Thanks for the feedback. I’ve added it to the EME faq-section.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘meta tags from Yoast SEO’ is closed to new replies.