85 lines
1.6 KiB
PHP
85 lines
1.6 KiB
PHP
<?php
|
|
|
|
// ##### Template parts 🡒 Get templates parts
|
|
|
|
get_template_part( 'template-parts/blocks/the-file', null,
|
|
array(
|
|
'ID'=>$my_post_id,
|
|
)
|
|
);
|
|
|
|
/** ------------------------------
|
|
QUERIES
|
|
------------------------------*/
|
|
|
|
// ##### Query 🡒 Get posts
|
|
|
|
$args = array('fields' => 'ids');
|
|
$posts = get_posts($args);
|
|
|
|
|
|
// ##### Query 🡒 Recent posts
|
|
|
|
$posts = wp_get_recent_posts([
|
|
'numberposts' => 4 ,
|
|
'post_status' => 'publish'
|
|
]);
|
|
|
|
|
|
// ##### Query 🡒 With Metaqueries
|
|
$args = array(
|
|
'post_type'=>'activities',
|
|
'post_status' => array( 'publish', 'future' ),
|
|
'numberposts' => '3',
|
|
'meta_key' => 'date',
|
|
'orderby' => 'meta_value',
|
|
'order' => 'ASC',
|
|
// ######## Main
|
|
'meta_query' => array(
|
|
array(
|
|
'key' => 'date',
|
|
'value' => $today,
|
|
'compare' => '>='
|
|
)
|
|
)
|
|
);
|
|
|
|
$recent_activites = wp_get_recent_posts($args);
|
|
|
|
// ##### Query 🡒 Wordpress Global Query Loop
|
|
|
|
$args = array('posts_per_page' => 6,'post_type' => 'post');
|
|
$the_query = new WP_Query( $args );
|
|
|
|
|
|
if ( $the_query->have_posts() ) {
|
|
echo '<ul>';
|
|
while ( $the_query->have_posts() ) {
|
|
$the_query->the_post();
|
|
echo '<li>' . get_the_title() . '</li>';
|
|
}
|
|
echo '</ul>';
|
|
} else {
|
|
// no posts found
|
|
}
|
|
/* Restore original Post Data */
|
|
wp_reset_postdata();
|
|
|
|
/** ------------------------------
|
|
POST DATES
|
|
------------------------------*/
|
|
$post_date = date_i18n('j F Y', strtotime($post['post_date']));
|
|
|
|
|
|
/** ------------------------------
|
|
URL
|
|
------------------------------*/
|
|
|
|
// ##### URL 🡒 Home Url
|
|
echo home_url('/admission/');
|
|
|
|
// ##### URL 🡒 Site Url
|
|
echo site_url('/admission/', 'https');
|
|
|
|
|