Jump to content

Скрипт вывода похожих записей вордпресс


Recommended Posts

В общем прописал данный скрипт
<h4>Похожие записи</h4>

<?php
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'showposts'=>4,
'orderby'=>rand,
'caller_get_posts'=>1);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '<ul>';
while ($my_query->have_posts()) {
$my_query->the_post();
?>

 

в single.php

 

и такой в css

 

#related_posts{margin:20px 0;float: left;width: 100%; }
#related_posts ul {;width: 700px;}
#box-cel{
min-height: 150px;
border:1px solid #bbb;
border-radius:3px;
float:left;
list-style: none;
margin: 1px;
padding: 5px;
text-align: center;
width: 149px;
}
#box-cel:hover{
background:#F9E9C2;
border: 1px dashed #39B6F

 

Но вывод записей отображается не адекватно. (с каждым последующим материалом смещается вниз) http://i077.radikal.ru/1410/21/456e7d3bc76e.png . В чем может быть проблема? Шаблон parament, может в нем косяк? Где копаться вообще? Спасибо за внимание

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...