how to add related post in artikle

Posted in: Newspaper
Post count: 30

Hy , where I can put code related post like in this picture ??? I ‘ve prepared the code only put its course >>>>> http://prntscr.com/9fj1i7
Thanks

Post count: 30

hi bos please come here 😀

Post count: 30

any admin here

Post count: 22421

Hello,
If you have a piece of code you wish to implement in a post template you need to edit the theme files corresponding to the post template: http://screencast.com/t/0AxZTrDdl These files are found in the main newspaper folder. Every post template uses 2 files: a single.php and a loo-single.php. The number corresponds to the post template you use. no number means default, 1 is template 1 so on and so forth.
Thank you!

Post count: 30

ok thanks gan

Post count: 30

Now I am confused should be placed where my code , I use the default single post template boss

Post count: 22421

Hi,

Well i do not know what code you want to place and what id does. If you can provide more details then maybe i can provide an answer, but if it will require hard coding implementation, then support will not be able to help you and you will need to hire a freelancer for it.

Thank you!

Post count: 30

this is my code sirrr

<?php
if(has_post_thumbnail()) {
echo ‘<div class=”td-post-featured-image”><figure>’;
$post_thumbnail_id = get_post_thumbnail_id();
$post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id ); ?>
” alt=”<?php echo get_the_title(); ?>” class=”entry-thumb wp-post-image” src=”<?php echo $post_thumbnail_url; ?>” style=”width:100%; height:auto;”>
<?php echo ‘<figcaption class=”wp-caption-text”>’;
echo get_post(get_post_thumbnail_id())->post_excerpt;
echo ‘</figcaption></figure></div>’;
} else {}
?>

<?php
$where = 1;
$content = apply_filters(‘the_content’, get_the_content());
$content = explode(‘</p>’, $content);
for ($i = 0; $i <count($content); $i++) {
if ($i == $where) { ?>
<?php
$orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);

if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
‘tag__in’ => $tag_ids,
‘post__not_in’ => array($post->ID),
‘posts_per_page’=>3, // Number of related posts to display.
‘caller_get_posts’=>1
);

$my_query = new wp_query( $args );
if($my_query->have_posts()){
echo'<div style=”margin-left: 20px”>
<h6>Baca juga :</h6>
<ul style=”margin-left: 15px”> ‘;

while( $my_query->have_posts() ) {
$my_query->the_post();
?>

  • ” rel=”bookmark” href=”<?php the_permalink()?>”>
    <?php the_title(); ?>
  • <?php }
    echo ‘</div>’;
    }
    }
    $post = $orig_post;
    wp_reset_query();
    ?>
    <?php
    }
    echo $content[$i] . ‘</p>’;
    }
    ?>

    Post count: 22421

    Hello,
    Unfortunately the implementation is not going to be so easy. Your code needs to be adapted to our code so you will need a bit of help on this one and support cannot offer it at the moment as time does not allow us to tackle such tasks. Sorry!

    Post count: 30

    oh no , than ????

    Post count: 22421

    Unfortunately we cannot offer any custom work at the moment as we are a small team and time does not allow us to tackle such tasks. We try to help out where we can and if the task is not too difficult, that is why i offered to help but unfortunately adapting the code will be no easy task. You can hire a freelancer to help you out from sites like studio.envato.com
    Thank you for your understanding!

    Viewing 11 posts - 1 through 11 (of 11 total)
    The forum ‘Newspaper’ is closed to new topics and replies.