2024-01-09 16:13:20 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Template part for displaying featured posts or "ajuts" and widgets
|
|
|
|
*
|
|
|
|
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
|
|
*
|
2024-01-13 13:44:31 +01:00
|
|
|
* @package Oficina_de_Suport_theme
|
2024-01-09 16:13:20 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<aside id="destacats" class="home-featured home-destacats">
|
|
|
|
<?php
|
|
|
|
// Detect plugin. For use on Front End only.
|
|
|
|
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
|
|
|
// check for plugin using plugin name
|
2024-01-13 13:44:31 +01:00
|
|
|
if ( is_plugin_active( 'oficinasuport-wp-plugin/ofisuport-wp-plugin.php' ) ) {
|
2024-01-09 16:13:20 +01:00
|
|
|
//plugin is activated do
|
|
|
|
?>
|
|
|
|
<header>
|
2024-01-13 13:44:31 +01:00
|
|
|
<h2> <?php echo esc_html__('Destacats', 'ofisuport'); ?></h2>
|
2024-01-09 16:13:20 +01:00
|
|
|
</header>
|
2024-01-13 13:44:31 +01:00
|
|
|
<main id="destacats" class="ofisuport-destacats ofisuport-featured">
|
2024-01-09 16:13:20 +01:00
|
|
|
|
|
|
|
<?php
|
|
|
|
// https://developer.wordpress.org/reference/functions/get_posts/
|
|
|
|
// https://www.advancedcustomfields.com/resources/true-false/
|
2024-01-13 13:44:31 +01:00
|
|
|
$featured_query = new WP_Query(
|
2024-01-09 16:13:20 +01:00
|
|
|
array(
|
2024-01-13 13:44:31 +01:00
|
|
|
'post_type' => array( 'post', 'ofisuport-ajut' ),
|
|
|
|
'posts_per_page' => '4',
|
2024-01-09 16:13:20 +01:00
|
|
|
'meta_query' => array(
|
|
|
|
array(
|
|
|
|
'key' => 'os_home_show',
|
|
|
|
'value'=> '1',
|
|
|
|
)
|
|
|
|
)
|
|
|
|
) );
|
|
|
|
?>
|
2024-01-13 13:44:31 +01:00
|
|
|
<?php if ( $featured_query->have_posts() ) : ?>
|
|
|
|
<?php while ( $featured_query->have_posts() ) : $featured_query->the_post(); ?>
|
2024-01-09 16:13:20 +01:00
|
|
|
|
|
|
|
<?php get_template_part( 'template-parts/section', 'eachpost' ); ?>
|
|
|
|
|
|
|
|
<?php endwhile;//end of the loop ?>
|
|
|
|
<?php wp_reset_postdata(); ?>
|
|
|
|
<?php else : //if no post in query ?>
|
|
|
|
<p class="no-content"></p>
|
|
|
|
<?php endif; //end query ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</main>
|
|
|
|
<?php } //closing if is_plugin_active ?>
|
|
|
|
<?php dynamic_sidebar( 'front-page-widgets' ); // including widget front page?>
|
|
|
|
</aside>
|