Register a custom feild

#17062
Viewing 15 replies - 1 through 15 (of 18 total)
  • Hello,

    Is WilokeListingTools plugin active on your site? The code we provided was to get the primary term value set from the WilokeListingTools plugin. You can add a condition to check if the Wiloke class exists in the code. Try replacing the vars code with the following:

    
    add_action( 'rank_math/vars/register_extra_replacements', function() {
    	$args = [
    		'name'    => esc_html__( 'Listing Category', 'rank-math' ),
    		'desc'    => esc_html__( 'Category of the current listing', 'rank-math' ),
    		'example' => RMPrimaryCategoryToListingCallback()
    	];
    	RankMath\Helper::register_var_replacement( 'listingCat', 'RMPrimaryCategoryToListingCallback', $args );
    
    	$args = [
    		'name'    => esc_html__( 'Listing Location', 'rank-math' ),
    		'desc'    => esc_html__( 'Location of the current listing', 'rank-math' ),
    		'example' => RMPrimaryLocationToListingCallback()
    	];
    	RankMath\Helper::register_var_replacement( 'listingLocation', 'RMPrimaryLocationToListingCallback', $args);
    });
    
    function RMPrimaryCategoryToListingCallback(){
    
    	if ( ! isset( $_GET['post'] ) || ! class_exists( 'WilokeListingTools' ) ) {
    		return '';
    	}
    
    	$post_id = $_GET['post'];
    	$termID = \WilokeListingTools\Framework\Helpers\GetSettings::getPrimaryTermIDOfPost($post_id, 'listing_cat');
    	if ( !empty($termID) ){
    		$oTerm = get_term($termID, 'listing_cat');
    		if ( !empty($oTerm) && !is_wp_error($oTerm) ){
    			return $oTerm->name;
    		}
    	}
    }
    
    function RMPrimaryLocationToListingCallback(){
    	if ( ! isset( $_GET['post'] ) || ! class_exists( 'WilokeListingTools' ) ) {
    		return;
    	}
    
    	$post_id = $_GET['post'];
    	$termID = \WilokeListingTools\Framework\Helpers\GetSettings::getPrimaryTermIDOfPost($post_id, 'listing_location');
    	if ( !empty($termID) ){
    		$oTerm = get_term($termID, 'listing_location');
    		if ( !empty($oTerm) && !is_wp_error($oTerm) ){
    			return $oTerm->name;
    		}
    	}
    
    }
    

    Hope that helps. Thank you.

    wiloke listing tools is active (https://prnt.sc/pj563i)
    same issue (https://prnt.sc/pj55ui)

    hi,
    somehow, i edited the code the managed to do .. and its working now smoothly…

    now, i want to show all listing tag in snippet not only primary…
    plz help..

    Todd
    Rank Math free

    Hi,

    Please ask your listings plugin provider for the variable for showing all listing tags. We will then be able to tell you how to use that within Rank Math.

    working for all tag now but one issue

    https://prnt.sc/pk5lhu (seo meta title & description) https://prnt.sc/pk5oi4
    https://prnt.sc/pk5mil (not showing in listing)

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins and the link of the page where the wrong description is displayed in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    Looking forward to helping you.

    • This reply was modified 4 years, 6 months ago by Pratik.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    The listing variables seems to be working fine on your site. Please check the screencast I added in the Sensitive Data section.

    Hope that helps. Thank you.

    Hi bro,

    That was manual work.. plz arrange date wise and latest listings…

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    U can also check by creating new listing

    plz response

    Hello,

    The value from Settings is used as a fallback when the title & description fields are empty. In some of your posts, you already added the text in the title and description fields. Please check the screencast I added in the Sensitive Data Section.

    If you want to overwrite the title and description in all the listings then please add below filter code in your theme’s functions.php file:

    
    add_filter( 'rank_math/frontend/title', function( $title ) {
    	if ( is_singular( 'listing' ) ) {
    		global $post;
    		return RankMath\Paper\Paper::get_from_options( "pt_listing_title", $post );
    	}
    	return $title;
    });
    
    add_filter( 'rank_math/frontend/description', function( $title ) {
    	if ( is_singular( 'listing' ) ) {
    		global $post;
    		return RankMath\Paper\Paper::get_from_options( "pt_listing_description", $post );
    	}
    	return $title;
    });
    
    

    This will show the title & description from your Settings on the frontend.

    Hope that helps. Thank you.

    Hi Pratik,

    I know that is showing frontend even in source code also,,,
    my point it must be shown in admin backend bcz in some listing ‘category’ is focus keywork… it not show how focus keywork will work…
    it must be like scrren shot highlighted area…
    https://prnt.sc/pm2141
    https://prnt.sc/pm21b4

    and i have pasted that code to function.php but not working
    showing like this https://prnt.sc/pm2vli

    Hello,

    my point it must be shown in admin backend bcz in some listing ‘category’ is focus keywork… it not show how focus keywork will work…
    it must be like scrren shot highlighted area…
    https://prnt.sc/pm2141
    https://prnt.sc/pm21b4

    Yes, the SERP preview in admin is not showing the Category values. Our Development team is aware of this issue. You’ll see an update soon with the fix.

    and I have pasted that code to function.php but not working
    showing like this https://prnt.sc/pm2vli

    I see you added the code in functions.php file and it seems to be working fine. I am not sure how you are checking this? The code we gave you changes the description value and the screenshot above shows some content that is displayed on the frontend. How are these 2 related?
    Here it shows the description you added in the Settings: view-source:{YOUR_SITE_URL}/listing/aurangabad/test-aurangabad/

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 15 replies - 1 through 15 (of 18 total)

The ticket ‘Register a custom feild’ is closed to new replies.