How to create page use template custom ?


I use theme Beans for project of my, i very like it. I can create custom templates for good categories. But when I apply it to a page. I encountered a duplicate image error and the title of the page.

Is there a way to help me remove it and remove the unnecessary meta tags contained in the template? Thank you! Here is the load template from category.

<?php
/* Template Name: Tin Tức*/

add_filter( 'beans_loop_query_args', 'beans_child_view_query_args' );

function beans_child_view_query_args() {

    return array(
        'category_name' => 'tin-tuc',
        'paged' => get_query_var( 'paged' )
    );

}

// Remove post meta.
beans_remove_action( 'beans_post_meta' );
beans_remove_action( 'beans_post_meta_tags' );
beans_remove_action( 'beans_post_meta_categories' );
beans_remove_action( 'beans_post_archive_title' );

// Remove post image.
beans_remove_action( 'beans_post_image' );

// Remove article box styling.
beans_remove_attribute( 'beans_post', 'class', 'uk-panel' );

//Add banner top
add_action( 'beans_header_after_markup', 'example_banner_top' );

function example_banner_top() {

    ?>
    <div class="banner-top"><?php echo do_shortcode( '[vc_single_image image="2270" img_size="full" alignment="center" css=".vc_custom_1512544886296{margin-top: 0px !important;margin-bottom: 0px !important;padding-top: 0px !important;padding-bottom: 0px !important;}"]' ); ?></div>
    <?php

}

// Add article divider.
add_action( 'beans_post_after_markup', 'example_article_divider' );

function example_article_divider() {

    ?><hr class="uk-article-divider" />  <?php

}
add_action( 'beans_breadcrumb_after_markup', 'example_tin_tuc' );

function example_tin_tuc() {

    ?>
    <div class="title-index">
    <h1 class="tieu-de-du-an" style="text-align: center;">TIN TỨC</h1>
    <div class="sub-title-index"></div>
 </div>
  <link rel="stylesheet" id="uikit-css" href="https://beanscommunity.wpenginepowered.com/wp-content/themes/tm-beans/chuyen-muc.css" type="text/css" media="all">
    <?php

}

// Trim the content and add cta link.
add_filter( 'the_content', 'example_troncate_content' );

function example_troncate_content( $content ) {

    ?>
  <div class="img-hover">
 <div class="animate">
   <div class="img-bai-viet" style="background: url(<?php the_post_thumbnail_url(); ?>);background-clip: border-box;background-repeat: no-repeat;background-position: 50% 50%;background-size: cover;">
    <a class="img-link" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"></a>
   </div>
  </div>
  </div>
  <div class="noi-dung">
    <h2 class="tieu-de-bv"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
   <?php 
      $title  = the_title('','',false);
     if(strlen($title) > 70):
        echo trim(substr($title, 0, 73)).'...';
     else:
       echo $title;
      endif;
    ?>
    </a></h2>
   <p><?php echo wp_trim_words( $content, 30, '...' ); ?></p>
  </div>
    <?php

}

// Load the document. Always Keep this at the bottom of the page template.
beans_load_document();

Write a reply

Login or register to write a reply, it's free!