<div class="main">
<div>
<?php $query = new WP_Query('cat=8'); ?>
<?php if ( $query->have_posts() ) : ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="panel">
<div class="panel-heading">
<a href="#1"><i class="fa fa-trophy"></i><?php the_title() ?></a>
</div>
<div class="panel-collapse">
<?php the_excerpt() ?>
<div class="button"><a href="<?php the_permalink() ?>">Read more</a></div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
$args = array(
'dropdown' => 0, // displays a list if set to 0, a dropdown list if set to 1 (default: 0)
'show_names' => 1, // displays language names if set to 1 (default: 1)
'display_names_as' => 'name', // either ‘name’ or ‘slug’ (default: ‘name’)
'show_flags' => 1, // displays flags if set to 1 (default: 0)
'hide_if_empty' => 1, // hides languages with no posts (or pages) if set to 1 (default: 1)
'force_home' => 0, // forces link to homepage if set to 1 (default: 0)
'echo' => 1, // echoes if set to 1, returns a string if set to 0 (default: 1)
'hide_if_no_translation' => 1, // hides the language if no translation exists if set to 1 (default: 0)
'hide_current' => 0, // hides the current language if set to 1 (default: 0)
'post_id' => null, // if set, displays links to translations of the post (or page) defined by post_id (default: null)
'raw' => 0, // use this to create your own custom language switcher (default:0)
);
pll_the_languages( $args );
<?php
$page_children = new WP_Query( array(
'post_type' => 'page',
'post_parent' => get_the_ID() // id текущей
));
if($page_children->have_posts()) {
while($page_children->have_posts()){
$page_children->the_post();
?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<?php }
}
wp_reset_query();
?>
function add_custom_rewrite_rule() {
if( ($current_rules = get_option('rewrite_rules')) ) {
foreach($current_rules as $key => $val) {
if(strpos($key, 'event') !== false) {
add_rewrite_rule(str_ireplace('event', 'events', $key), $val, 'top');
} // end if
} // end foreach
} // end if/else
//flush_rewrite_rules();
} // end add_custom_rewrite_rule
add_action('init', 'add_custom_rewrite_rule');
function na_remove_slug( $post_link, $post, $leavename ) {
if ( 'event' != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}
$post_link = str_replace( '/' . $post->post_type . '/', '/events/', $post_link );
return $post_link;
}
add_filter( 'post_type_link', 'na_remove_slug', 10, 3 );
add_action( 'template_redirect', function() {
if( is_singular( 'event' ) ){
global $post;
if ( $_SERVER['REQUEST_URI'] == '/event/'.$post->post_name) {
wp_redirect( home_url('/events/'.$post->post_name), 301 );
exit();
}
}
} );