I nostri migliori ricercatori hanno esaurito le loro scorte di caffè, cercando continuamente la soluzione, finché Esmeralda non ha trovato la soluzione su GitHub, quindi ora la condivide con noi.
Esempio 1: creare un modello di pagina personalizzato wordpress
/* make this file in template-parts folder
give file name as category_post.php */
/**
* Template Name: Category Custom Page
*/get_header();?><divid="primary"class="content-area"><mainid="main"class="site-main"role="main">$args=array('post_type'=>'post','post_status'=>'publish','category_name'=>'wordpress','posts_per_page'=>5,);$arr_posts=newWP_Query($args);if($arr_posts->have_posts()):while($arr_posts->have_posts()):$arr_posts->the_post();?><articleid="post-the_ID();?>"post_class();?>>if(has_post_thumbnail()):the_post_thumbnail();endif;?><headerclass="entry-header"><h1class="entry-title">the_title();?>h1>header><divclass="entry-content">the_excerpt();?><ahref="the_permalink();?>">Read Morea>div>article>endwhile;wp_pagenavi(array('query'=>$arr_posts,));endif;?>main>div>get_footer();?>
Esempio 2: wordpress definisce il nome del template
/*on top of Php file add the below line to make as custom template*/
/* Template Name: Custom template name */?>
Ricordati di raccomandare questa cronaca se ti ha aiutato.