Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 380 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Yoast SEO | How to create custom variables

#1
Was just wondering if there is a way to create a **custom variable** so that I can add my custom variable created in the Meta title of the page.

Yoast SEO has a list of variables predefined [here][1].

It would be great if I could create a variable of my own. Is there any way to get this?

Thanks in advance!


[1]:

[To see links please register here]

Reply

#2
There is a way, but as far as I know, you must get a Premium account in Yoast Seo. One of the most important functions of both Yoast SEO and Yoast SEO Premium is the possibility to add title templates and meta description templates to the homepage, all (custom) post types, all (custom) taxonomies and other pages.

Note: Template variables can also be used on individual posts, pages and taxonomies.

Setting up / changing your templates

You can change your title & meta templates by going to the admin of your WordPress installation and clicking SEO → Titles & Metas.

1. Log in to your WordPress website. When you're logged in, you will be in your 'Dashboard'. On the left-hand side, you will see a menu. In that menu, click on 'SEO'.
2. The 'SEO' settings will expand providing you additional options. Click on 'Titles & Metas'.
3. Under each tab, you can use these variables to create templates for various pages within your site.
You can use the variables from the partial list below to create your own templates for the titles and meta-descriptions. The full list of variables is listed on the HELP tab of the plugin. Just go to SEO → Titles & Metas and click the help tab in the top right.

For more about that and see many images of the process, please visit this page:

[To see links please register here]

Reply

#3
You have two options for this.

1. Add filter for change exist variable.
2. Add your new custom variable.


If you want to change exist variable, you can do it like this:

// define the wpseo_replacements callback
function filter_wpseo_replacements( $replacements ) {
if( isset( $replacements['%%page%%'] ) ){
$replacements['%%page%%'] = 'Page x of y';
}
return $replacements;
};
// Add filter
add_filter( 'wpseo_replacements', 'filter_wpseo_replacements', 10, 1 );


And if do you want to add custom variable you can do it like this:

// define the custom replacement callback
function get_myname() {
return 'My name is Moses';
}

// define the action for register yoast_variable replacments
function register_custom_yoast_variables() {
wpseo_register_var_replacement( '%%myname%%', 'get_myname', 'advanced', 'some help text' );
}

// Add action
add_action('wpseo_register_extra_replacements', 'register_custom_yoast_variables');


I hope I was helpful to you.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through