This topic has 10 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #176241
     Scorpyons
    Participant

    Hi,

    How do I change snippets/schema.org tags in the pages?

    #176325
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #176439
     Radu
    Moderator

    Here it’s our function for the schema.org, paste it to child theme and change it as you need.

    COPY CODE
    
    /* Schema org for body */
    if ( ! function_exists( 'kleo_get_schema_org_markup' ) ) {
    
    	function kleo_get_schema_org_markup() {
    		$schema = 'http://schema.org/';
    		if ( is_singular( 'post' ) ) {
    			$type = "Article";
    		} elseif ( is_singular( 'portfolio' ) ) {
    			$type = "VisualArtwork";
    		} else {
    			if ( is_author() ) {
    				$type = 'ProfilePage';
    			} // Is search results page
    			elseif ( is_search() ) {
    				$type = 'SearchResultsPage';
    			} else {
    				$type = 'WebPage';
    			}
    		}
    
    		$type = apply_filters( 'kleo_schema_org_type', $type );
    
    		return 'itemscope itemtype="' . $schema . $type . '"';
    	}
    
    }
    
    function kleo_schema_org_markup() {
    	echo kleo_get_schema_org_markup();
    }
    
    

    The function needs to be pasted in wp-content/themes/kleo-child/functions.php

    NOTE : Child theme needs to be installed and activated.

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #176516
     Scorpyons
    Participant

    Hi,

    I followed the instructions, but when I inserted the code in wp-content/themes/kleo-child/functions.php, when I access the site a get the following error message: Fatal error: Cannot redeclare kleo_schema_org_markup() (previously declared in /home/masteraquaristz/aquaristz.com/wp-content/themes/kleo-child/functions.php:56) in /home/masteraquaristz/aquaristz.com/wp-content/themes/kleo/lib/theme-functions.php on line 2522

    Here is a screenshot of the issue:
    https://gyazo.com/7f101ab624ea11495f0104cc8122f318

    I reverted the change for now.

    Can you help me?

    #176551
     Radu
    Moderator

    Hi,

    In this case add only this code

    COPY CODE
    
    /* Schema org for body */
    if ( ! function_exists( 'kleo_get_schema_org_markup' ) ) {
    
    	function kleo_get_schema_org_markup() {
    		$schema = 'http://schema.org/';
    		if ( is_singular( 'post' ) ) {
    			$type = "Article";
    		} elseif ( is_singular( 'portfolio' ) ) {
    			$type = "VisualArtwork";
    		} else {
    			if ( is_author() ) {
    				$type = 'ProfilePage';
    			} // Is search results page
    			elseif ( is_search() ) {
    				$type = 'SearchResultsPage';
    			} else {
    				$type = 'WebPage';
    			}
    		}
    
    		$type = apply_filters( 'kleo_schema_org_type', $type );
    
    		return 'itemscope itemtype="' . $schema . $type . '"';
    	}
    
    }
    

    Let me know
    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #176566
     Scorpyons
    Participant

    Hi,

    It seems that most of the pages are working now.

    I don’t see any changes on the profile page. If you access any profile page (https://www.aquaristz.com/membros/raphael-martins/profile/), you don’t see ProfilePage type. Can you help me with this?

    Also, how can I include itemtype=”http://schema.org/DiscussionForumPosting” to the forum?

    #176847
     Radu
    Moderator

    Hi,

    Replace with this one

    COPY CODE
    
    /* Schema org for body */
    if ( ! function_exists( 'kleo_get_schema_org_markup' ) ) {
    
    	function kleo_get_schema_org_markup() {
    		$schema = 'http://schema.org/';
    		if ( is_singular( 'post' ) ) {
    			$type = "Article";
    		} elseif ( is_singular( 'portfolio' ) ) {
    			$type = "VisualArtwork";
    		} else if (bp_is_user()) {
    			$type = 'ProfilePage';
    		} else {
    			if ( is_author() ) {
    				$type = 'ProfilePage';
    			} // Is search results page
    			elseif ( is_search() ) {
    				$type = 'SearchResultsPage';
    			} else {
    				$type = 'WebPage';
    			}
    		}
    
    		$type = apply_filters( 'kleo_schema_org_type', $type );
    
    		return 'itemscope itemtype="' . $schema . $type . '"';
    	}
    
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #176952
     Scorpyons
    Participant

    Hi,

    it’s working now! Regarding Forum, how can I include itemtype=”DiscussionForumPosting” to the forum?

    Should I include something like this?

    elseif ( is_singular( ‘forum’ ) ) {
    $type = “DiscussionForumPosting”;

    Is this correct or should I code something else?

    #176974
     Radu
    Moderator

    Hi,

    Yes exactly,

    Did you have any other suggestions to make the snippet to cover more components at once.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #176981
     Scorpyons
    Participant

    Hi Radu, Thanks for your response.

    I have few familiarity with PHP, so sorry for my stupid questions. Just to confirm, for foruns, should we use:

    elseif ( is_singular( ‘forum’ ) ) {

    or

    elseif ( is_bbpress() ) {

    which should I use? Also, I do have suggestions that you guys can include in seventhqueen/schema-org-body-header.php.

    You guys could include this forum improvment, and since the theme is multipurpose, you guys could also include schema.org tags related to places (Geodirectory), tags related to contact page (http://schema.org/ContactPage).

    These changes would make the theme much more complete.

    Regards,

    #177045
     Radu
    Moderator

    Hi,

    For the forums just use the next function https://pastebin.com/raw/7Vz4wCDV

    For the contact page use the next snippet https://pastebin.com/raw/7bgqRbBK

    The function needs to be pasted in wp-content/themes/kleo-child/functions.php

    NOTE : Child theme needs to be installed and activated.

    That’s it, the bbPress will be included in next theme update, for the contact page you will have to add the code.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?