Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #6189

    Hi,

    Ii need to show the category post and the date on the top of the post image in a custom template with columm, wich file i have to mod?

    I think that i have to insert in helper-template.php this code, how i have to do it?

    http://www.soluzionipercomunikare.com/test/?page_id=87

    //check if we should display post content

    
if(strpos($data, ‘post’) !== false)

    
{


    $output .= “<div class=’entry-content’>”;
$output .= “—->>>POST CATEGORY—->>>POST DATE <h1 class=’post-title’>”.get_the_title().”</h1>”;

    $output.= avia_excerpt(150);


    $output.= ” “.__(‘Read more’, ‘avia_framework’).”<span></span>”;

    
$output.= ‘</div>’;

    
$extraClass = $extraClass.’_content’;
}
}

    #53213

    Hey,

    you need to modify includes/helper-templates.php – you can find the right code after following line:

    function column_helper_loop_over_posts($data)

    #53214

    I have to add the data (dd/mm/yy) and the name of category.

    Can u give the code and where i have to add it?

    Thanks a lot!

    S.

    #53215

    Hey,

    I can’t provide custom code here but you can use: http://codex.wordpress.org/Function_Reference/get_the_category and http://codex.wordpress.org/Function_Reference/get_the_category

    I’d use the code after following line:

    $output .= "<div class='entry-content'>";

    #53216

    was here..

    how can i insert dynamic (CATEGORY and DATE dd/mm/yy) there?

    $output .= “CATEGORY<span > dd/mm </span><h1 class=’post-title’>“.get_the_title().”</h1>”;

    #53217

    i wrote this

    $output .= “Categoria”. get_the_category() .”<span > dd/mm </span><h1 class=’post-title’>“.get_the_title().”</h1>”;

    BUT IT SHOW “array”

    #53218

    Try following code instead:

    $category_list ='';
    foreach((get_the_category()) as $category) {
    $category_list .= $category->cat_name.',';
    }
    $category_list = substr($category_list, 0, -1);
    $output .= "Categoria". $category_list ."<span > dd/mm </span><h1 class='post-title'>".get_the_title()."</h1>";

    #53219

    i tried

    but in browser it show me:

    Catchable fatal error: Object of class stdClass could not be converted to string in /web/htdocs/www.viktormag.com/home/wp-content/themes/shoutbox/includes/helper-templates.php on line 574

    here the code:

    //check if we should display post content

    if(strpos($data, ‘post’) !== false)

    {

    $output .= “<div class=’entry-content’>”;

    //HERE THE PROBLEM

    $category_list =”;

    foreach((get_the_category()) as $category) {

    $category_list .= $category.’,';

    }

    $category_list = substr($category_list, 0, -1);

    $output .= “Categoria”. $category_list .”<span > dd/mm </span><h1 class=’post-title’>”.get_the_title().”</h1>”;

    //HERE THE PROBLEM

    $output.= avia_excerpt(150);

    $output.= ” “.__(‘Read more’, ‘avia_framework’).”<span></span>“;

    $output.= ‘</div>’;

    $extraClass = $extraClass.’_content’;

    }

    }

    }

    wp_reset_query();

    $output = “<div class=’post-entry “.$extraClass.”‘>”.$output.”</div>”;

    return $output;

    }

    }

    #53220

    I corrected the code above a bit. Instead of $category it should be $category->cat_name

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Show category post’ is closed to new replies.