I don’t understand much of what’s going on there, I also have to read more of the filtering stuff.
Actually, this is very easy. The first argument of the add_filter
statement is the name of the filter. The second argument is the name of the filtering function. This function is given an array containing the generated metatags (it depends on the filter used).
Modify the contents of that array and finally return it. That’s all. Easy, right?
Can I bribe you ?? with a new language for your plugin in exchange for that filtering code for the language meta ?
Hehe, not necessary, but a Romanian translation would be very welcome!
Will that appear on each page so I can type the language in a box? Or how? This second I cannot imagine how it would work.
You can change the metatags programmatically by using a filtering function. Of course you could add a custom metabox in the post editing panel, but that would involve some more work.
Below is a more detailed example. This adds an example opengraph metatag og:foo
on post with ID 345:
function my_customize_opengraph( $metatags ) {
// ... modify $metatags array here ...
if ( is_single() ) {
$post = get_queried_object();
if ( $post->ID == 345 ) {
// Add our meta tag
$metatags[] = '<meta property="og:foo" content="bar" />';
}
}
return $metatags;
}
add_filter( 'amt_opengraph_metadata_head', 'my_customize_opengraph', 10, 1 );
I haven’t actually tested this, but I hope you get the idea.
Sorry if I offended you in any way, I didn’t mean to. I know some html, css but not so much php. Thank you,
Absolutely no offense! Unfortunately, I guess, some php coding skills are required. I can only give you an idea about how to do it. That’s the best I can do at this time. ??
Kind Regards,
George