Переменные для сниппета в плагине Yoast SEO (Available variable types) для WordPress

в разделе WordPress. комментарии: 0

Переменные для сниппета в плагине Yoast SEO (Available variable types) для WordPress. Дата актуальности 7/09/2020.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Basic variables
Label   Variable    Description
Date    %%date%%    Replaced with the date of the post/page
Title   %%title%%   Replaced with the title of the post/page
Parent title    %%parent_title%%    Replaced with the title of the parent page of the current page
Archive title   %%archive_title%%   Replaced with the normal title for an archive generated by WordPress
Site title  %%sitename%%    The site’s name
Tagline %%sitedesc%%    The site’s tagline
Excerpt %%excerpt%% Replaced with the post/page excerpt (or auto-generated if it does not exist)
Excerpt only    %%excerpt_only%%    Replaced with the post/page excerpt (without auto-generation)
Tag %%tag%% Replaced with the current tag/tags
Category    %%category%%    Replaced with the post categories (comma separated)
Primary category    %%primary_category%%    Replaced with the primary category of the post/page
Category description    %%category_description%%    Replaced with the category description
Tag description %%tag_description%% Replaced with the tag description
Term description    %%term_description%%    Replaced with the term description
Term title  %%term_title%%  Replaced with the term name
Search phrase   %%searchphrase%%    Replaced with the current search phrase
Separator   %%sep%% The separator defined in your theme’s wp_title() tag.

Label   Variable    Description
Post type (singular)    %%pt_single%%   Replaced with the content type single label
Post type (plural)  %%pt_plural%%   Replaced with the content type plural label
Modified    %%modified%%    Replaced with the post/page modified time
ID  %%id%%  Replaced with the post/page ID
Name    %%name%%    Replaced with the post/page author’s ‘nicename’
User description    %%user_description%%    Replaced with the post/page author’s ‘Biographical Info’
Page number %%page%%    Replaced with the current page number with context (i.e. page 2 of 4)
Pagetotal   %%pagetotal%%   Replaced with the current page total
Pagenumber  %%pagenumber%%  Replaced with the current page number
Caption %%caption%% Attachment caption
Focus keyword   %%focuskw%% Replaced with the posts focus keyphrase
Term404 %%term404%% Replaced with the slug which caused the 404
<custom-field-name> (custom field)  %%cf_<custom-field-name>%%  Replaced with a posts custom field value. Remove the <>
<custom-tax-name> (custom taxonomy) %%ct_<custom-tax-name>%%    Replaced with a posts custom taxonomies, comma separated. Remove the <>
<custom-tax-name> description (custom taxonomy) %%ct_desc_<custom-tax-name>%%   Replaced with a custom taxonomies description. Remove the <>

Custom taxonomies
Custom taxonomy names can be found in the browser bar on the backend when viewing or editing an item.

Example: edit-tags.php?taxonomy=mycategory&post_type=myposttype

In the example above, we are editing a custom taxonomy called mycategory under a custom post type called myposttype. If I wanted to output a list of categories assigned to a myposttype page, I would use %%ct_mycategory%%. Alternatively, if I wanted to output the description of an individual mycategory on the category archive page, I would use %%ct_desc_mycategory%% .

WooCommerce variables
%%ct_product_cat%%  Product category (comma separated)
%%ct_product_tag%%  Product tag (comma separated)
%%ct_pa_<product-attribute-slug>%%  Product attribute (comma separated). Be sure to remove the <> as they are not needed.

Yoast WooCommerce SEO variables

%%wc_shortdesc%%    Replaced with the short description of the product. (Available as of Yoast WooCommerce SEO 6.2)
%%wc_sku%%  Replaced with the inventory stock-keeping unit (sku) of the product. (Available as of Yoast WooCommerce SEO 6.2)
%%wc_brand%%    Replaced with the brand name. This variable only works with ‘WooCommerce Brands‘ and ‘Perfect WooCommerce Brands‘ plugins. (Available as of Yoast WooCommerce SEO 6.2)
%%wc_price%%    Replaced with price of the product. (Available as of Yoast WooCommerce SEO 6.2)

Deprecated variables

%%userid%%  Replaced with the post/page author’s userid
%%currenttime%% Replaced with the current time
%%currentdate%% Replaced with the current date
%%currentday%%  Replaced with the current day
%%currentmonth%%    Replaced with the current month
%%currentyear%% Replaced with the current year

Default variables
%%title%% %%page%% %%sep%% %%sitename%%%    Posts, Pages, Products, Media, and Custom Post Types
%%pt_plural%% Archive %%page%% %%sep%% %%sitename%% Posts, Products, and other Custom Post Type Archive Pages
%%term_title%% Archives %%page%% %%sep%% %%sitename%%   Taxonomies
You searched for %%searchphrase%% %%page%% %%sep%% %%sitename%% Special Pages: Search Page
Page Not Found %%sep%% %%sitename%% Special Pages: 404 Pages
%%name%%, Author at %%sitename%% %%page%%   Author Archive Pages
%%date%% %%page%% %%sep%% %%sitename%%  Date Archive Pages
The post %%POSTLINK%% appeared first on %%BLOGLINK%%.   RSS Feed
%%sitename%% %%page%% %%sep%% %%sitedesc%%  Homepage Template

Creating custom template variables
Adding your own template variables can be done using the wpseo_register_extra_replacements filter in your functions.php file.

Взято с оригинального сайта. С русского IP не всегда открывается.





Комментировать