Skip to main content

get title content in wordpress

<?php
   
   $trimtitle = get_the_title();   
   
    $shorttitle = wp_trim_words( $trimtitle, $num_words = 4, $more = '… ' );
   
    echo '<h6 class="info-title">' . '<a href="' . get_permalink() . '">' . $shorttitle . '</a></h6>';
   
    $trimexcerpt = get_the_excerpt();
   
    $shortexcerpt = wp_trim_words( $trimexcerpt, $num_words = 50, $more = '… ' );
   
    echo '<p>' . $shortexcerpt . '</p>';
   
    ?>


<a class="more-link button" href="<?php the_permalink() ?>" style="margin: 23px 0px -24px;">Read More</a>

Comments

Popular posts from this blog

add custom post type

/**  *  * add custom post type  *  */ function my_custom_post_product() {   $labels = array(     'name'               => _x( 'Products', 'post type general name' ),     'singular_name'      => _x( 'Product', 'post type singular name' ),     'add_new'            => _x( 'Add New', 'book' ),     'add_new_item'       => __( 'Add New Product' ),     'edit_item'          => __( 'Edit Product' ),     'new_item'           => __( 'New Product' ),     'all_items'          => __( 'All Products' ),     'vi...

Toolset conditional

[wpv- if evaluate= "'[wpv-current-user info='id']' = '[wpv-post-author format='meta' meta='ID']' OR '[wpv-current-user info='role']' = 'administrator'" ]      //the content you want to hide goes here [/wpv- if ]