Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Get the current page URL
- $current_url = home_url( $_SERVER['REQUEST_URI'] );
- // Define the FAQ page URL
- $course_archive_url = 'https://example.com/courses';
- // Check if the current page is the Courses page
- if ( $current_url == $$course_archive_url ) {
- add_filter( 'rank_math/frontend/robots', function( $robots ) {
- // Change the robots tag to index
- $robots['index'] = 'index';
- // Return the modified robots array
- return $robots;
- });
- /**
- * Filter to change the page title.
- *
- * @param string $title
- */
- add_filter( 'rank_math/frontend/title', function( $title ) {
- $title = "Courses Archive – Example";
- return $title;
- });
- /**
- * Allow changing the meta description sentence from within the theme.
- *
- * @param string $description The description sentence.
- */
- add_filter( 'rank_math/frontend/description', function( $description ) {
- $description = "Description here yo!";
- return $description;
- });
- /**
- * Add <meta name="keywords" content="focus keywords">.
- */
- add_filter( 'rank_math/frontend/show_keywords', '__return_true');
- /**
- * Allow changing the meta keywords from the default Focus Keywords.
- *
- * @param string $keywords Keywords.
- */
- add_filter( 'rank_math/frontend/keywords', function( $keywords ) {
- $keywords = "Courses, Masterclasses, Guitar";
- return $keywords;
- });
- /**
- * Allows developers to change the OpenGraph image within theme.
- *
- * The dynamic part of the hook name. $network, is the network slug. Can be facebook or twitter.
- *
- * @param string $attachment_url The image we are about to add.
- */
- add_filter( "rank_math/opengraph/facebook/image", function( $attachment_url ) {
- $attachment_url = "https://example.com/media/general/branding/courses-banner.jpg";
- return $attachment_url;
- });
- add_filter( "rank_math/opengraph/twitter/image", function( $attachment_url ) {
- $attachment_url = "https://example.com/media/general/branding/courses-banner.jpg";
- return $attachment_url;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment