// ##### Syntax
$my_post_id,
)
);
/** ------------------------------
QUERIES
------------------------------*/
// ##### Query 🡒 Get posts
$args = array(
'fields' => 'ids',
'post_type' => 'restaurants',
'posts_per_page' => -1
);
$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 '';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '- ' . get_the_title() . '
';
}
echo '
';
} 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');
/** ------------------------------
ENABLE SVG
------------------------------*/
/* */
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
/** ------------------------------
INIT WIDGET
------------------------------*/
function tailwind_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Discover_next', 'tailwind' ),
'id' => 'discover_next',
'description' => esc_html__( 'Add widgets here.', 'tailwind' ),
'before_widget' => '',
'before_title' => '',
)
);
}