-
-
Save igorbenic/eb97eb252a72c81b0f463b49ec5d1539 to your computer and use it in GitHub Desktop.
| <?php | |
| function change_yoast_seo_og_meta() { | |
| add_filter( 'wpseo_opengraph_desc', 'change_desc' ); | |
| } | |
| function change_desc( $desc ) { | |
| // This article is actually a landing page for an eBook | |
| if( is_singular( 123 ) ) { | |
| $desc = __( 'The best eBook you can have on your laptop, tablet or smartphone. See what others are reading to improve their career.', 'change_textdomain'); | |
| } | |
| return $desc; | |
| } |
| <?php | |
| add_action( 'wpseo_opengraph', 'change_yoast_seo_og_meta' ); | |
| /** | |
| * Function to add hooks and filter out the Yoast SEO Open Graph Meta Tags | |
| */ | |
| function change_yoast_seo_og_meta() { | |
| // We will add the code here to change the meta tags | |
| } |
| <?php | |
| function change_yoast_seo_og_meta() { | |
| add_filter( 'wpseo_opengraph_image', 'change_image' ); | |
| } | |
| function change_image( $image ) { | |
| if( $image == 'http://url_for_image_to_change' ) { | |
| $image = 'http://url_to_our_new_image'; | |
| } | |
| return $image; | |
| } |
| <?php | |
| function change_yoast_seo_og_meta() { | |
| add_action( 'wpseo_add_opengraph_images', 'add_images' ); | |
| } | |
| function add_images( $object ) { | |
| $image = 'http://url_to_our_image.png'; | |
| $object->add_image( $image ); | |
| } |
| <?php | |
| function change_yoast_seo_og_meta() { | |
| add_filter( 'wpseo_locale', 'change_locale' ); | |
| } | |
| function change_locale( $locale ) { | |
| // Article with the ID 123 is Croatian | |
| // Other Articles are on English (or any site setting) | |
| if( is_singular( 123 ) ) { | |
| $locale = 'hr_HR'; | |
| } | |
| return $locale; | |
| } |
| <?php | |
| // Code from Yoast SEO Plugin | |
| public function og_tag( $property, $content ) { | |
| $og_property = str_replace( ':', '_', $property ); | |
| /** | |
| * Filter: 'wpseo_og_' . $og_property - Allow developers to change the content of specific OG meta tags. | |
| * | |
| * @api string $content The content of the property | |
| */ | |
| $content = apply_filters( 'wpseo_og_' . $og_property, $content ); | |
| if ( empty( $content ) ) { | |
| return false; | |
| } | |
| echo '<meta property="', esc_attr( $property ), '" content="', esc_attr( $content ), '" />', "\n"; | |
| return true; | |
| } |
| <?php | |
| function change_yoast_seo_og_meta() { | |
| add_filter( 'wpseo_opengraph_title', 'change_title' ); | |
| } | |
| function change_title( $title ) { | |
| // Landing Page eBook | |
| if( is_singular( 123 ) ) { | |
| $bought = get_bought_count_id( 123 ); | |
| // Change the title if it was already sold to more than 100 | |
| if( $bought > 100 ) { | |
| $title = __( 'Get the eBook that was read by more than 100 people', 'change_textdomain' ); | |
| } | |
| } | |
| return $title; | |
| } |
| <?php | |
| function change_yoast_seo_og_meta() { | |
| add_filter( 'wpseo_opengraph_type', 'change_type' ); | |
| } | |
| function change_type( $type ) { | |
| // This article is actually a landing page for an eBook | |
| if( is_singular( 123 ) ) { | |
| $type = 'book'; | |
| } | |
| return $type; | |
| } |
| <?php | |
| function change_yoast_seo_og_meta() { | |
| add_filter( 'wpseo_opengraph_url', 'change_url' ); | |
| } | |
| function change_url( $url ) { | |
| // This article is actually a landing page for an eBook | |
| if( is_singular( 123 ) ) { | |
| $url = add_query_arg( 'from', 'facebook', $url ); | |
| } | |
| return $url; | |
| } |
"Apologies - just a small question - why are there 2 functions for each filter? its a bit messy an unneeded i think ;)"
Agreed, man, thanks for suggesting the more simple version. At first with the 2 functions i failed badly, cos i forgot to call the 1st function, so your approach is definitely more dumb-safe..:D. Thank you for both of you for the solutions! Best wishes
Agreed, man, thanks for suggesting the simpler approach. At first, I struggled when handling multiple steps, since I forgot the first part entirely. Similarly, Nofal Apparel drives innovation with style and practicality, standing out as a trusted brand that delivers quality clothing designed for everyday wear.
Police Clearance Online Appointment is a system that lets applicants book, manage, and confirm police clearance visits online, saving time and avoiding long queues at police stations.
Civil id office timing usually Monday to Friday 9:00 AM se 5:00 PM tak hoti hai. Kuch bade shehron mein offices ya mega centers 24/7 bhi open rehte hain taake log asani se apni ID related services hasil kar saken
Boredflix App is a fast-growing streaming platform that brings movies, TV shows, and anime into one ad-free space using smart discovery and public data sources. With AI-powered browsing, 4K playback, and wide device support, it offers a smooth, no-sign-up entertainment experience for cinema lovers worldwide.https://boredflixhd.app/
Interesting snippet—sometimes even small code tweaks can change how everything behaves, especially when you start experimenting beyond the default setup. It reminds me of how people play around with an asphalt android game mod just to explore different mechanics without the usual limits, just to see how things respond differently. That kind of trial-and-error approach, whether in code or games, often helps you understand the system on a much deeper level.
Nano Banana AI is a smart platform designed to simplify content creation with advanced artificial intelligence tools, helping users work faster and more efficiently. It enables the quick generation of ideas, text, and creative outputs while reducing effort and saving time. With Nano Banana AI, tasks become easier to manage and overall productivity increases in less time. Explore more details now on https://www.nano-banana.com/.
HappyHorse AI is an advanced platform built to enhance productivity through smart automation and creative tools. It helps users generate content, ideas, and solutions quickly, making complex tasks simple and efficient. With its intelligent system, HappyHorse AI supports smoother workflows and better results across different digital needs.
SATXwraps is a vehicle wrapping service focused on giving cars a fresh, customized look with premium-quality vinyl designs. It enhances both style and surface protection, making every vehicle stand out on the road. With skilled application and modern design options, SATXwraps delivers a clean and professional finish every time. Explore more details now on https://satxwraps.com/
Ayesha’s Collection brings together modern modest fashion with beautifully designed outfits for women seeking elegance and comfort. From premium hijabs to graceful abayas, the collection features stylish clothing made with attention to detail and quality fabrics. Ayesha’s Collection is appreciated for offering fashionable modest wear that suits both casual and formal occasions. For more information you can visit https://www.ayeshas-collection.com/.
Where Is My Train Now helps travelers check live train locations and real-time running status with ease. Users can track arrivals, departures, and route updates instantly. The platform makes train journey planning faster, simpler, and more reliable. Visit now https://whereismytrainnow.com.in/.
This is a helpful guide for developers who want more control over their website's Open Graph metadata. Proper social sharing optimization can make a big difference in how content is presented across platforms. The same attention to detail is valuable for sites like 3D printer, where well-optimized content and clear metadata help users discover useful 3D printing resources more easily.
RadBoard is a dedicated employment platform that helps radiology professionals connect with trusted healthcare employers nationwide. It showcases a variety of opportunities, including remote radiology jobs, giving physicians greater flexibility in choosing roles that suit their experience and preferred work environment. RadBoard streamlines the career search with specialized listings created exclusively for the radiology community.
Thanks for sharing.
Programmatically changing Yoast SEO Open Graph meta can be handled using WordPress filters to customize social sharing data dynamically. 1pppp keeps the interface clean and clutter-free, letting players jump straight into Teen Patti or Rummy tables without extra steps. Visit now https://1pppapk.com.pk/.
This is a useful and well-organized gist. The practical approach makes the information easy to follow, especially for someone looking to understand the implementation rather than just the theory. Thanks for sharing!
https://pinvideoindirici.com.tr/
A useful topic for WordPress developers, especially when you need more control over how pages appear when shared on social media.
Completing a J188 download unlocks card games, slots, and fish games from a single home screen. New accounts typically register using a phone number and OTP verification.https://j188.net/
This is a useful guide for developers working with Yoast SEO and WordPress metadata. Before your Royal X Casino APK download begins make sure unknown sources are enabled in your Android security settings. Our step by step screenshots guide you through this one time setup in seconds.
It would be interesting to see what kind of companies and roles are featured on the blog. Start your Master Royale download on any Android phone running version 5.0 or higher with at least 200MB free space. Both budget handsets and flagship devices run the Clash Royale private server smoothly.
It would be interesting to see whether it tracks typing speed and accuracy over time. The Game Vault download works on all Android devices running version 5.1 and above without root access or modifications. Budget phones handle the app just as smoothly as premium flagship models.
I wonder if the blog also shares tips about interviews, resumes, and recruitment processes. Tournament formats in a popular rummy card game pit hundreds of players against each other for prize pools growing hourly. Ranked competition identifies the best performers and rewards them proportionally.
It’s interesting to see how slot gaming has changed over the years with new technology and digital platforms. Security protocols on 3PATTIRoom include end to end encryption, OTP login, and secure wallet architecture. Your money and personal information receive the same protection standards as banking apps.
Programmatically changing these meta tags can be helpful when different pages need customized social sharing information. Timed turns in every Card Rummy game keep matches flowing at a steady pace without frustrating delays between moves. Balanced clock settings give enough time for thinking while preventing intentional stalling.
Apologies - just a small question - why are there 2 functions for each filter? its a bit messy an unneeded i think ;)
Example for changing the title:
working on this now (for a project) and it works...