2022-12-28 21:56:26 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2022-12-29 00:18:04 +01:00
|
|
|
* Template part for displaying featured posts or "ajuts" and widgets
|
2022-12-28 21:56:26 +01:00
|
|
|
*
|
|
|
|
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
|
|
*
|
|
|
|
* @package Oficina_de_Suport_theme
|
|
|
|
*/
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
2022-12-30 13:23:05 +01:00
|
|
|
<aside id="destacats" class="home-featured home-destacats">
|
2022-12-28 21:56:26 +01:00
|
|
|
<?php
|
|
|
|
// Detect plugin. For use on Front End only.
|
|
|
|
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
|
|
|
// check for plugin using plugin name
|
|
|
|
if ( is_plugin_active( 'oficinasuport-wp-plugin/ofisuport-wp-plugin.php' ) ) {
|
|
|
|
//plugin is activated do
|
|
|
|
?>
|
|
|
|
<header>
|
2022-12-30 21:15:45 +01:00
|
|
|
<h2> <?php echo esc_html__('Destacats', 'ofisuport'); ?></h2>
|
2022-12-28 21:56:26 +01:00
|
|
|
</header>
|
|
|
|
<main id="destacats" class="ofisuport-destacats ofisuport-featured">
|
2022-12-29 00:18:04 +01:00
|
|
|
|
|
|
|
<?php
|
|
|
|
// https://developer.wordpress.org/reference/functions/get_posts/
|
|
|
|
// https://www.advancedcustomfields.com/resources/true-false/
|
|
|
|
$the_query = new WP_Query(
|
|
|
|
array(
|
|
|
|
'post_type' => 'any',
|
|
|
|
'post_per_page' => '4',
|
|
|
|
'meta_query' => array(
|
|
|
|
array(
|
|
|
|
'key' => 'os_home_show',
|
|
|
|
'value'=> '1',
|
|
|
|
)
|
|
|
|
)
|
|
|
|
) );
|
|
|
|
?>
|
|
|
|
<?php if ( $the_query->have_posts() ) : ?>
|
|
|
|
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
|
|
|
|
|
2022-12-29 23:27:17 +01:00
|
|
|
<?php get_template_part( 'template-parts/section', 'eachpost' ); ?>
|
2022-12-29 00:18:04 +01:00
|
|
|
|
|
|
|
<?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 ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-28 21:56:26 +01:00
|
|
|
</main>
|
|
|
|
<?php } //closing if is_plugin_active ?>
|
2022-12-29 00:18:04 +01:00
|
|
|
<?php dynamic_sidebar( 'front-page-widgets' ); // including widget front page?>
|
2022-12-28 21:56:26 +01:00
|
|
|
</aside>
|