custom field to be used as meta description

This topic contains 8 replies, has 3 voices, and was last updated by  Steffen 5 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #437532

    Steffen
    Lifetime Member
    Post count: 48

    Hello,
    I asked following request as a presales question to Paolo:
    “Is it possible to define a custom field, which can be filled by the user as Metadescription?”

    His Answer was: yes, It is possible to define a custom field to be used as meta description, however you’ll need a code snippet for your theme.

    If you ask for it in our forum, our development team would be more than happy to assist you with this.

    Can you please assist me with this.

    Thanks and regads,
    Steffen

    #437542

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #437664

    Steffen
    Lifetime Member
    Post count: 48
    This reply has been marked as private.
    #437759

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Steffan,

    Have you already setup the field? If so if you provide wp-admin i will set it up for you 🙂

    Thanks,

    Stiofan

    #437847

    Steffen
    Lifetime Member
    Post count: 48
    This reply has been marked as private.
    #437894

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    What field do u want to use?

    This is an example of how to do it: https://wpgeodirectory.com/support/topic/meta-title-tages/#post-369400

    Stiofan

    #438011

    Steffen
    Lifetime Member
    Post count: 48

    Hi Stiofan,
    I want to give the users a field where they can add a custom meta description. I think best would be a text area field without editor. The content should be used as meta description for the search engines.

    Thanks and regards,
    Steffen

    #438024

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Its setup now 🙂

    For future reference this is the code:

    
    
    add_filter( 'geodir_filter_title_variables_vars', '_my_custom_meta_description_seo_vars',10,4);
    
    function _my_custom_meta_description_seo_vars( $title, $location_array, $gd_page, $sep ){
    	global $post;
    
    	if ( strpos( $title, '%%custom_meta_desc%%' ) !== false && !empty($post->geodir_meta_desc) ) {
    		
    		$title = str_replace( "%%custom_meta_desc%%", $post->geodir_meta_desc, $title );
    	}
    
    	return $title;
    }

    Thanks,

    Stiofan

    #438026

    Steffen
    Lifetime Member
    Post count: 48

    Great! Thank you very much!

Viewing 9 posts - 1 through 9 (of 9 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket