<?php while ( have_posts() ): the_post(); ?>
<?php get_template_part('content-standard'); ?>
<?php endwhile; ?>
// создали область меню.
function register_my_menus() {
register_nav_menus(
array(
'main_menu' => 'Главное меню'
)
);
}
add_action( 'init', 'register_my_menus' );
<?php wp_nav_menu( array( 'theme_location' => 'main_menu' ) ); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
вставить и проверить вывод<?php echo $post->post_title."<BR>"; ?>
//в начале wp-config.php
// во второй строке к примеру
$_SERVER['HTTPS'] = 'on';
// в конце перед
/* Это всё, дальше не редактируем. Успехов! */
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
<?php
$content = '
<i>Расписание</i>
<i>Расписание</i>
<i>Расписание</i>';
$cont = mb_convert_encoding( $content, 'HTML-ENTITIES', 'UTF-8' );
$dom = new DomDocument();
$dom->loadHTML( $content );
$xpath = new DomXPath( $dom );
foreach( $xpath->query( './/i' ) as $element ) {
echo "<div class=\"parent\">" . $element->C14N() . PHP_EOL . "</div>" . PHP_EOL;
}
<?php
$facebook = $header_setting['social_media_facebook_link'];
$twitter = $header_setting['social_media_twitter_link'];
$linkdin = $header_setting['social_media_linkedin_link'];
$social = '<ul id="%1$s" class="%2$s">%3$s';
if($header_setting['header_social_media_enabled'] == 0 )
{
$social .= '<ul class="head-contact-social">';
if($header_setting['social_media_facebook_link'] != '') {
$social .= '<li class="facebook"><a href="'.$facebook.'"';
if($header_setting['facebook_media_enabled']==1)
{
$social .= 'target="_blank"';
}
$social .='><i class="fa fa-facebook"></i></a></li>';
}
if($header_setting['social_media_twitter_link']!='') {
$social .= '<li class="twitter"><a href="'.$twitter.'"';
if($header_setting['twitter_media_enabled']==1)
{
$social .= 'target="_blank"';
}
$social .='><i class="fa fa-twitter"></i></a></li>';
}
if($header_setting['social_media_linkedin_link']!='') {
$social .= '<li class="linkedin"><a href="'.$linkdin.'"';
if($header_setting['linkedin_media_enabled']==1)
{
$social .= 'target="_blank"';
}
$social .='><i class="fa fa-linkedin"></i></a></li>';
}
$social .='</ul>';
}
$social .='</ul>';
?>
add_filter('dashboard_glance_items', 'add_to_glance');
function add_to_glance( Array $items )
{
$items[] = "<div>counter</div>";
return $items;
}
<?php setPostViews(get_the_ID()); ?>
<?php echo getPostViews(get_the_ID()); ?>
<?php the_post_thumbnail('medium'); ?>
<?php the_post_thumbnail(array(250, 100)); ?>
<div class="boxcontainer">
<?php
$last_month_args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'posts_per_page' => 10,
'paged' => $paged,
'date_query' => array( array( 'after' => '1 year ago' )));
$last_month_posts = new WP_Query( $last_month_args );
// создадим пустую переменную
$ym_ = "";
if ( $last_month_posts->have_posts() ) {
while ( $last_month_posts->have_posts() ) {
$last_month_posts->the_post();
// запишем год и месяц
$ym = get_the_date('Ym', $post->ID);
// другой год или месяц
if ( $ym_ != $ym ) {
// выведем месяц и год
echo "<H2>".get_the_date('F Y', $post->ID)."</H2>";
}
// выведем пост из шаблона
get_template_part('pinbox', get_post_format());
// сохраним текущий месяц и год для сравнения со следующей записью
$ym_ = $ym;
}
}else{}
wp_reset_postdata(); ?>
</div>
<?php
<?php
/*
Plugin Name: getheader
Description: get some wp data
Version: 0.1
Author: Author
Author URI: www.mysite.com
*/
add_action( 'init', 'gh_getheader' );
function gh_getheader()
{
if ( isset( $_GET['getheader'] ) && $_GET['getheader'] === 'true' )
{
$menus = get_terms('nav_menu');
foreach($menus as $menu){
$items = wp_get_nav_menu_items($menu->name);
$result['menus'][$menu->name] = array();
foreach ($items as $item)
{
$result['menus'][$menu->name][] = array(
'url'=> $item->url,
'title'=> $item->title
);
}
echo json_encode($result);
exit;
}
}
}