Главная страница (Is Page)

Условные теги WordPress
Условные теги (Conditional Tags) можно использовать в файлах-шаблонах Темы для того, чтобы указывать какой контент отображать на определенной странице в зависимости от того, выполнены ли какие-либо из заданных условий для этой страницы. Например, вы можете отображать какой-то текст только на главной странице. C условным тегом is_home () сделать это легко.
Работа всех условных тегов построена на том, чтобы в тот момент, когда выполнено конкретное условие, вернуть TRUE (т.е. сработать). Все возможные условия перечислены ниже.

Главная страница

Содержание

is_home ()
Когда отображается главная страница (в WordPress 2.1 эта функция работает по-другому, чем в более старых версиях WordPress, смотрите static Front Page.)

Главная страница (новый тег)

is_front_page ()
Когда отображается главная страница блога, вне зависимости от того, что на ней выводится: записи или Статическая Страница. Срабатывает когда показывается главная страница блога, при этом не важно что стоит в настройках: Настройки->Чтение->На главной странице отображать Ваши последние записи или Постоянная страница. Кстати: этот условный тег добавлен в WordPress версии 2.5 и выше.

Панель администратора

is_admin ()
Когда отображается Доска объявлений или меню администратора.

Одиночная запись

is_single ()
Когда отображается одиночный пост.
is_single (’17’)
Когда отображается одиночный пост с id=17.
is_single (‘Irish Stew’)
Когда отображается одиночный пост с заголовком «Irish Stew».
is_single (‘beef-stew’)
Когда отображается одиночный пост с короткой ссылкой beef-stew.
is_single (array (17,’beef-stew’,’Irish Stew’))
Когда отображается одиночный пост, при этом должно сработать хотя бы одно условие из трех для этой записи: 1) ID 17 или 2) короткая ссылка «beef-stew» или 3) заголовок «Irish Stew». Кстати: возможность использования массива была добавлена в WordPress версии 2.5.

Любая страница, на которой выводятся записи

comments_open ()
Когда комментарии разрешены для текущего Поста, обрабатываемого в Цикле.
pings_open ()
Когда пинги разрешены для текущего Поста, обрабатываемого в Цикле.

Постоянные страницы

Это относится только к Постоянным страницам.

is_page ()
Когда отображается Постоянная страница.
is_page (’42’)
Когда отображается Постоянная страница с id=42
is_page (‘About Me And Joe’)
Когда отображается Постоянная страница с заголовком «About Me And Joe».
is_page (‘about-me’)
Когда отображается Постоянная страница с короткой ссылкой «about-me».
is_page (array (42,’about-me’,’About Me And Joe’))
Когда отображается Постоянная страница, при этом должно сработать хотя бы одно условие из трех для этой Постоянной страницы: 1) ID 42 или 2) короткая ссылка «about-me» или 3) заголовок «About Me And Joe». Кстати: возможность использования массива была добавлена в WordPress версии 2.5.

Дочерние страницы Постоянной страницы

Такого условного тега как is_subpage () не существует, но вы можете использовать такой код:

<?php
// Get $post if you're inside a function
global $post;
if (is_page() && $post->post_parent ) {
// This is a subpage
} else {
// This is not a subpage
}
?>

Если вам нужно узнать: это текущая Постоянная страница или дочерняя страница этой конкретной Постоянной страницы (например, для того, чтобы отображать разные баннеры на разных Постоянных страницах, включая их «дочки»), посмотрите в админ. панели ID Постоянной страницы первого уровня и затем используйте этот код, который выведет разные баннеры:

  • на Постоянной странице (ID=2) с короткой ссылкой about и всех ее подстраницах-дочках баннер home.jpg
  • на Постоянной странице (ID=56) с короткой ссылкой learning и всех ее подстраницах-дочках баннер teaching.jpg
  • * и т.д.

<?php if (is_page(about) || $post->post_parent=="2") {
$bannerimg="home.jpg";
} elseif (is_page(learning) || $post->post_parent=="56") {
$bannerimg="teaching.jpg";
} elseif (is_page(admissions) || $post->post_parent=="15") {
$bannerimg="admissions.jpg";
} else {
$bannerimg="home.jpg" ; // Fall-through
}
?>

Используется ли индивидуальный шаблон страницы

Начиная с WordPress версии 2.5 и выше можно определить, какой Индивидуальный шаблон используется для вывода конкретной страницы.

is_page_template ()
Используется ли какой-либо индивидуальный шаблон для отображения Постоянной страницы?

is_page_template (‘about.php’)
Используется ли индивидуальный шаблон ‘about.php’? Заметьте, что этот условный тег в отличие от остальных, если вы хотите определить конкретный шаблон Постоянной страницы, то используйте имя файла, т.е. about.php или my_page_template.php.

Страница рубрики

is_category ()
Когда отображается рубрика.
is_category (‘9’)
Когда отображается рубрика с ID=9.
is_category (‘Stinky Cheeses’)
Когда отображается рубрика с названием «Stinky Cheeses».
is_category (‘blue-cheese’)
Когда отображается рубрика с короткой ссылкой «blue-cheese».
is_category (array (9,’blue-cheese’,’Stinky Cheeses’))
Когда отображается рубрика, при этом должно сработать хотя бы одно условие из трех для этой рубрики: 1) ID 9 (term_ID) или 2) короткая ссылка «blue-cheese» или 3) название «Stinky Cheeses». Кстати: возможность использования массива была добавлена в WordPress версии 2.5.
in_category (‘5’)
Когда отображается одиночная запись, которая находится в рубрике с ID=5. Подробнее тут

Кстати: запомните, что is_category и in_category это совершенно разные условные теги!

Страница тега (метки)

is_tag ()
Когда отображается страница архива тега (список постов с этим тегом).
is_tag (‘mild’)
Когда отображается страница архива тега ‘mild’.
is_tag (array (‘sharp’,’mild’,’extreme’))
Когда отображается архив тега, при этом должно сработать хотя бы одно условие из трех для этой страницы: 1) короткая ссылка «sharp», «mild», или «extreme». Кстати: возможность использования массива была добавлена в WordPress версии 2.5.
has_tag ()
Когда текущий пост имеет тег. Используется внутри Цикла. Кстати: возможность использования массива была добавлена в WordPress версии 2.6.
has_tag (‘mild’)
Когда текущий пост имеет тег ‘mild’.
has_tag (array (‘sharp’,’mild’,’extreme’))
Когда текущий пост имеет тег какой-либо тег из перечисленных в массиве.

Страница автора

is_author ()
Когда отображается страница автора.
is_author (‘4’)
Когда отображается страница автора, у которого ID=4.
is_author (‘Vivian’)
Когда отображается страница автора с ником «Vivian».
is_author (‘john-jones’)
Когда отображается страница автора с именем «john-jones».
is_author (array (4,’john-jones’,’Vivian’))
Когда отображается страница автора, при этом должно сработать хотя бы одно условие из для этой страницы: ID автора = 4, имя «john-jones», или ник «Vivian». Кстати: возможность использования массива была добавлена в WordPress версии 2.5.

Страница даты

is_date ()
Когда отображается архив любого периода времени (за месяц, за год, за день или архив основанный на дате).
is_year ()
Когда отображается архив за год.
is_month ()
Когда отображается архив за месяц.
is_day ()
Когда отображается архив за день.
is_time ()
Когда отображается почасовой архив за час, поминутный или посекундный.

Еще по теме:   Селектор атрибутов CSS

Страница архива

is_archive ()
Когда отображается любой тип архива, буть то рубрика, страница тега, страница автора и даты.

Страница результатов поиска

is_search ()
Когда отображается страница результатов поиска.

Страница ошибки 404 (ничего не найдено)

is_404 ()
Когда на какой-либо странице случается ошибка «HTTP 404: Не найдено».

2,3,4 и т.д. страницы

is_paged ()
Когда отображается 2, 3 и т.д. страницы блога. Это относится к страницам архива или главной странице блога, когда вы переходите по ссылке Ранее (в Теме default) или на 2, 3, 4 и т.д. страницы (когда используется плагин типа wp-pagenavi). Это не относится к разбиению поста или Постоянной страницы на страницы с помощью тега <!—nextpage—> QuickTag.

Аттачмент (прикрепленный файл)

is_attachment ()
Когда отображается на отдельной (своей) странице аттачмент (прикрепленный файл) к посту или Постоянной странице. Обычно это картинка или любой другой файл, загруженный через стандартный загрузчик при написании/редактировании поста или Постоянной страницы. Аттачменты можно отображать на их собственной странице и использовать для них свой шаблон в папке Теме. для более детальной информации посетите страницу Using Image and File Attachments.

RSS лента

is_feed ()
Этот условный тег обычно не используется обычными пользователями, а используется самим WordPress или разработчиками плагинов.

Трэкбек

is_trackback ()
Этот условный тег обычно не используется обычными пользователями, а используется самим WordPress или разработчиками плагинов.

Предпросмотр

is_preview ()
Когда отображается одиночный неопубликованный пост в режиме предпросмотра.

Есть ли цитата (excerpt) у поста?

!empty ($post->post_excerpt)
Штатного способа проверки на существование цитаты (excerpt) у поста НЕТ, но вы можете использовать приведенный выше код. Удалите восклицательный знак ‘!’ из этого кода чтобы выполнять проверку ‘нет цитаты’.

Работающие примеры

Здесь несколько примеров для демонстрации того, как следует использовать условные теги.

Одиночный пост

Этот пример показывает как использовать условный тег is_single () для того, чтобы отобразить информацию только на странице одиночного поста:

<?php if (is_single())
{
echo 'Это один из постов в рубрике ' . single_cat_title() . ', вот так!';
}
?>

Разница, основанная на дате

Если кто-то просматривает ваш блог по датам, то он увидит «помеченные» посты разных лет разным цветом бэкграунда:

<?php
// начинаем Цикл
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2 id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Постоянная ссылка <?php the_title(); ?>">
<?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small><?php
// если отображаем архив даты
if (is_date())
{
if (date('Y') != get_the_date('Y'))
{
// этот пост был написан в прошлом году
// поэтому припишем css класс "oldentry" к блоку с постом,
// чтобы придать ему отличный от других блоков вид
echo '<div class="oldentry">';
} else {
echo '<div class="entry">';
}
} else {
echo '<div class="entry">';
}
the_content('Далее »');
?>
</div>

Разный контент в боковой колонке (сайдбаре)

Этот пример выводит различный контент в боковой колонке в зависимости от того, какой тип контента просматривается в текущий момент.

<!-- начало боковой колонки -->
<div id="sidebar">
<?php
// let's generate info appropriate to the page being displayed
if (is_home()) {
// на главной странице покажем список рубрик первого уровня:
echo "<ul>";
wp_list_cats('optionall=0&sort_column=name&list=1&children=0');
echo "</ul>";
} elseif (is_category()) {
// на странице рубрики покажем все рубрики всех уровней
echo "<ul>";
wp_list_cats('optionall=1&sort_column=name&list=1&children=1&hierarchical=1');
echo "</ul>";
} elseif (is_single()) {
// на странице одиночного поста покажем... что-нибудь, впишите сами:

} elseif (is_page()) {
// на странице Постоянной страницы. А какой именно?
if (is_page('Обо мне')) {
// Постоянная страница About
echo "<p>Это страница обо мне!</p>";
} elseif (is_page('Используемые плагины')) {
echo "<p>На этой странице список используемых плагинов, я использую WordPress версии " . bloginfo('version') . "</p>";
} else {
// для всех других Статичных страниц
echo "<p>Привет, я Педро!</p>";
}
} else {
// для всех остальных типов страниц (архивов, страницы рез-тов поиска, 404 ошибки и т.д.)
echo "<p>Педро славный парень.</p>";
} // на этом все!
?>
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div>
<input type="text" name="s" id="s" size="15" />
<input type="submit" value="<?php _e('Search'); ?>" />
</div>
</form></div>
<!-- конец боковой колонки -->

www.wp-info.ru

There is a general notion towards page segmentation. For most search engines, this has been done mainly to reduce levels of noise in a page. In other words, page segmentation is a study technique devised by search engines to calculate the importance or relevance of a page to the web. Noise levels are calculated based on the amount of information contained in a website. Segments of the page that contain little or no information to offer readers are considered as noise and therefore not important. An example is a navigation block, which is used by many website owners to drive traffic to their sites. Most of these block have very little to do with the keyword. Search engines do not use these blocks to determine the rank of that page.

A simple example of this can be described when reading segments such as ‘privacy policy’ and ‘about us’ on a website. Such sections do not really determine what a page is about and are therefore irrelevant according to search engines. Website owners can reduce the noise levels by reducing content that is not relevant and will therefore not contribute towards a better rankings. Search engines use page segmentation to determine just how much of the content on a page is relevant and how much is merely for generating traffic. However, this task can be very daunting because not many pages can be described as being focused on just one topic. In addition, page segmentation sometimes will not tell advertisements apart from the content itself. Advertisements and search results for 3rd parties can increase the noise level of a page erroneously.

To ensure that page segmentation helps web users as opposed to increasing their noise levels, search engines pair up this analysis with behavioral metrics and link analysis. This can help website owners achieve their desired ranking and reduce their noise levels. Page segmentation analysis treats a page as one regardless of the links that are in it. The links may be to content that is either related or completely irrelevant to the search query. If page segmentation included both internal and external links, page owners could achieve their rankings by linking their pages to other pages that have related content.

Another factor would be enabling website owners to build links towards a page with related content. This page will have many different anchor texts and will therefore reduce noise levels. Many search engines have a problem determining if a page is SEO ready or whether it is good for business. Page segmentation enables users to build their links towards a provided main category page that contains related content. Page segmentation also calculates relevance based on the content in one particular block in relation to the entire page. If it was determined from one page to another, users would have higher chances of being ranked as relevant. The impact of page segmentation on SEO is not clear. Content providers should therefore focus their most relevant content and keywords in their title tags to ensure that their sites are not termed irrelevant.

www.paggu.com

What is Page Authority?

 

Page Authority (PA) is a score developed by Moz that gives suggestions on how well a certain page will rank on SERP. Similar to Domain Authority rate, this score ranges from 1 to 100. To calculate the data from Mozscape web index is taken. PA checker uses a machine learning model to identify the algorithm that shows the best correlation within SERP’s rankings.

 

How is Page Authority scored?

 

Moz uses a 100-point logarithmic scale to score PA rank. Those that use the Page Ranking Check service must know that growing the score from 70 to 80 is significantly harder than from 20 to 30.

 

Indicators of “good” page authority

 

We want to highlight that Page Authority checker is, first of all, a comparative tool, so the notion of “good” or “bad” score is not relatable here. You must know your goals before using PA checker. And your goal must be specific. You should know what this data does for you. A correct, specific goal is when you want to build a coherent system of buying links, and plan your next steps in link building. Before this, it is important to know the general state of a link profile that affects DA and PA.

 

Page Authority vs. Domain Authority

 

Every site that refers to your page transmits it a certain part of link authority. It can be considered as a kind of vote for quality of your page and the entire website. The more votes you get, the higher search engines will rank your site. So the thing is that both the website and a certain page have their authority levels. They gain it according to similar criteria and to keep the integrity of the website you must know both domain and page authority rates. It can happen, that both these scores can differ significantly.

 

Where can you check Page Authority?

 

There are many SEO and online marketing platforms across the web that have a PA checking tool. The most trustworthy platform for PA and DA checking is Moz. Of course, there are lots of new SEO services that appear every day. It is better to use the one that gives you the most accurate score.

 

Technical definition of Page Authority

 

Page Authority is defined the same way as Domain Authority, but only data concerning one specific page is taken into consideration. To count this score, PA checker includes 40+ factors. But, it does not take into consideration such on-page elements like keyword frequency or content quality. Page Authority depends on the quality of page’s link profile in the first place. If a good, well-trusted source refers your page, it is a sign of quality content quality for the search engines.

 

How do I influence Page Authority?

 

Like Domain Authority, Page Authority is score calculated according to a bunch of other scores. Many processes influence it directly, so finding the exact reason of PA rank changes is difficult, but you can make predictions, then – hypothesis and run experiments to improve your score and Page Authority level. Google includes several criteria to rank your page, and all of them affect your score.

The right thing to do, after you learn your PA score is to create some order in your link profile. Does this page have enough strong links to gain the page authority level you want? Does this page have links from untrustworthy websites that are badly recognized by search engines? After you find an answer to this questions, you will be able to operate with PA score data correctly.

 

Reasons for Page Authority changes

 

People usually use Page Authority checker to see fluctuations in their score. Because this rate basically depends on the link profile, and changes with your links will affect the PA score.
For example, if you know that the more external links from well-trusted websites you have, the better your PA score is, this is not necessarily 100% true. Search engines notice if a certain website grows links more rapidly than others, then detects it as harmful actions and downgrades your website.

Remember that the correct promotion of the website is both an art and a science.

sitechecker.pro

Привет всем! Все кто работал с WordPress особенно те, кто разрабатывает коммерческие сайты на этом движке, сталкивались с использованием функции is_page().

Кратко говоря, эта функция позволяет делать выборку определенных станиц по ID, title, slug, а также делать выборку целых по массиву данных.

Вот как выглядит пример использования данной функции взятый из сайта developer.wordpress.org:

  // When any single Page is being displayed.  is_page();  // When Page 42 (ID) is being displayed.  is_page( 42 );  // When the Page with a post_title of "Contact" is being displayed.  is_page( 'Contact' );  // When the Page with a post_name (slug) of "about-me" is being displayed.  is_page( 'about-me' );  /*  * Returns true when the Pages displayed is either post ID 42,  * or post_name "about-me", or post_title "Contact".  * Note: the array ability was added in version 2.5.  */  is_page( array( 42, 'about-me', 'Contact' ) );  

Как мы видим из последнего примера с массивом, мы можем выводить определенные блоки с информацией на целом списке страниц, которые мы указываем через запятую.

В этой статье я хотел бы показать, еще два альтернативных метода выводить информацию на различных страницах с помощью функции is_page().

Первый метод это использование логических операторов PHP, в частности использование оператора ИЛИ («||»).

Как это выглядит на практике:

  if(is_page(42) || is_page('about-me') || is_page('Contact')) { /* Тут вставляем нужный блок с информацией */ }  

В примере выше используется конструкция if, которая является условием, при исполнении которого и буде выводиться заданный нами блок. Зачастую, на практике, нужно на разных шаблонах страниц выводить различные типы блоков, например различные типы слайдеров или же разные формы для оформления заказа, и при этом всем есть общие страницы, для которых используется стандартный блок, например «заказать звонок». Немного запутано написал. Для наглядности, например у вас в дизайне есть блок для формы заказа звонка, но на странице прайс-листа вы хотите, что бы в этом же блоке вместо обратного звонка выводилась форма заказа актуального прайс-листа на сегодняшнее число. Так думаю, будет понятнее.

Именно в таких случаях мы можем расширить конструкцию if:

  if (is_page(42)) {  /* Выводим блок для первой страницы */  } elseif(is_page('about-me')) {  /* Выводим блок для второй страницы */  } else {  /* Код, который будет на всех остальных страницах */  }  

Вот с помощью таких простых функций вы можете уже начать выводить различную информацию на нужных вам страницах. Подписывайтесь на обновления моего сайта, впереди еще много чего интересного.

webprovincia.com

Testing for sub-Pages

There is no is_subpage() function yet, but you can test this with a little code:

Snippet 1

 // If outside the loop. $post = get_post();  if ( is_page() && $post->post_parent ) {  // This is a subpage } else {  // This is not a subpage } 

You can create your own is_subpage() function using the code in Snippet 2. Add it to your functions.php file. It tests for a parent page in the same way as Snippet 1, but will return the ID of the page parent if there is one, or false if there isn’t.

Snippet 2

Expand full source codeCollapse full source code

It is advisable to use a function like that in Snippet 2, rather than using the simple test like Snippet 1, if you plan to test for sub pages frequently.

To test if the parent of a page is a specific page, for instance “About” (page id pid 2 by default), we can use the tests in Snippet 3. These tests check to see if we are looking at the page in question, as well as if we are looking at any child pages. This is useful for setting variables specific to different sections of a web site, so a different banner image, or a different heading.

Snippet 3

 <?php if ( is_page( 'about' ) || '2' == $post->post_parent ) {  	// the page is "About", or the parent of the page is "About" 	$bannerimg = 'about.jpg'; } elseif ( is_page( 'learning' ) || '56' == $post->post_parent ) {	 	$bannerimg = 'teaching.jpg'; } elseif ( is_page( 'admissions' ) || '15' == $post->post_parent ) {  	$bannerimg = 'admissions.jpg'; } else {  	$bannerimg = 'home.jpg'; // just in case we are at an unclassified page, perhaps the home page }	 ?> 

Snippet 4 is a function that allows you to carry out the tests above more easily. This function will return true if we are looking at the page in question (so “About”) or one of its sub pages (so a page with a parent with ID “2”).

Snippet 4

Expand full source codeCollapse full source code

Add Snippet 4 to your functions.php file, and call is_tree( 'id' ) to see if the current page is the page, or is a sub page of the page. In Snippet 3, is_tree( '2' ) would replace “is_page( 'about' ) || '2' == $post->post_parent” inside the first if tag.

Note that if you have more than one level of pages the parent page is the one directly above and not the one at the very top of the hierarchy.

developer.wordpress.org

Use WordPress’ is_page() To Display Custom Content

wordpressnotebook

Published: 2010-01-11

Something that comes up on a regular basis is how to display certain content on different pages or if certain conditions are met. One way to accomplish this would be to create separate templates for each page. However, if you have a bunch of pages this can quickly become a pain. The other way to accomplish this would be to use WordPress’ is_page() function to display content when you want.

First let’s take a look at what the function is. According to the codex

This Conditional Tag checks if Pages are being displayed. This is a boolean function, meaning it returns either TRUE or FALSE.

Ok, that’s not the most helpful description ever. A simpler explanation would be that the tag checks the name of the page and returns TRUE or FALSE. This means you can put a nice little echo in there and have it display whatever you want.

So let’s say you have one page.php file. This is the template you use on every page on your site. On your about page you would like to add a secondary navigation. I don’t know why you want to, let’s just say you do. This navigation sits above the content area, so you can’t just add it into your page through the WordPress wysiwyg editor. Again, you could create a new template for the page, but that is boring. Instead, where you want the second navigation to be, enter this into your page.php file.

The code is asking if the page is named «about», if it is, it echo’s the div «secondnav». If the page isn’t called «about» then it echo’s nothing and nothing is displayed. It’s that simple. If you want the nav to display on the «about»and «contact»page add this

One place I find myself using this a lot is loading javascript only on pages that need it. One problem of adding javascript links to your footer.php file is that they are called on everypage whether you need them or not. The simple way to call them only when need is to add them like this

This works well for pages, but for your blog page and single posts you will need a different function.

For your blog page use is_home()

For your single posts use is_single()

WordPress provides a slew of other tags as well including

is_home(), is_front_page(), is_search(), is_404(), is_singular(), is_page(), is_attachment(), is_local_attachment(), is_single(), is_sticky(), is_archive(), is_category(), is_tag(), is_author(), is_date(), is_year(), is_month(), is_day(), is_time(), is_admin(), is_preview(), is_paged(), is_page_template(), is plugin active(), is_plugin_page(), is_new_day(), is_feed(), is_trackback(), is_comments_popup(), comments_open(), pings_open(), is_taxonomy(), is_taxonomy_hierarchical(), is_term(), is_user_logged_in(), is_blog_installed(), is_active_sidebar(), is_dynamic_sidebar(), is_active_widget()

As you can see, you can target pretty specific events and conditions. So have fun experimenting with conditional tags and if you come up with something cool, let me know in the comments.

Edit: To use regular PHP and not WordPress to include content, see my post here.

www.travisberry.com

Функция is_page_template: описание, использование

Синтаксис ее следующий:

Функция определят установлен ли указанный в параметре один или несколько шаблонов для данной конкретной страницы. Возвращает булевое значение True / False.

У нее есть всего один параметр — $template (string|array), где размещается название шаблона для проверки (в нашем примере сверху это был бы page-main.php).

Если файл находится в подкатегории, то пишете путь через слеш:

Данное решение нельзя использовать внутри цикла Loop, но тут есть альтернатива в виде функция get_page_template_slug( $post_id ). Она возвращает путь (адрес) установленного шаблона или пустую строку. Использовать ее можно как в цикле, так и вне его:

Но вернемся к нашей основной функции is_page_template. Вот вам простой пример ее применения:

В данном случае в страницах с шаблоном page-main.php будет использоваться дополнительный стиль class=»inner-main», который для всех остальных опускается.

Это может пригодиться, допустим, если в обоих шаблонах (page.php и page-main.php) вызываются одинаковые блоки header(), sidebar() и т.п. Тогда условия IF из примера выше размещаются в этих файлах дабы внедрять разный код для разных шаблонов.

wordpressinside.ru

Поделиться:
Нет комментариев

Добавить комментарий

Ваш e-mail не будет опубликован. Все поля обязательны для заполнения.

×
Рекомендуем посмотреть
Adblock
detector