Προς το περιεχόμενο

Προτεινόμενες αναρτήσεις

Δημοσ.

Γειά σε όλους. Είμαι καιρό μέλος στο site αλλά δέν πολυ έγραφα :)

Έχω ένα wordpress site το οποίο το έχω μετατρέψει να αλλάζει sidebar στο single ανάλογα με την κατηγορία την οποία ειναι το άρθρο.

Τις τελευταίες μέρες έχω ένα περίεργο πρόβλημα. προσπάθησα να βάλω τυχαία άρθρα απο κάτω και ενώ φαίνονται μια χαρά το sidebar crasharei και δέν αλλάζει ανάλογα με την κατηγορία αλλα δείχνει το default όπως και επίσης δέν φαίνονται τα comments.

 

Παραθέτω τον κώδικα εδώ

>
<div id="randombar">

<div id="block1">
<?php
$args = array( 'numberposts' => 1, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
$rand_posts = get_posts( $args );
foreach( $rand_posts as $post ) : ?>



<?php endforeach; ?>



<div id="ranbombarthumb1>
<?php
if (function_exists('get_the_image')){
 get_the_image( array( 'meta_key' => 'feature_img','width' => '110', 'height' => '120', 'image_class' => 'feature','image_scan' => 'true','cache' => 'true', 'default_image' => 'http://heaven-news.net/wp-content/uploads/2012/04/noimage.jpg') ); }



?> 
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
</div>
</div>

<div id="block2">
<?php
$args = array( 'numberposts' => 1, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
$rand_posts = get_posts( $args );
foreach( $rand_posts as $post ) : ?>



<?php endforeach; ?>



<div id="ranbombarthumb2>
<?php
if (function_exists('get_the_image')){
 get_the_image( array( 'meta_key' => 'feature_img',  'width' => '110', 'height' => '120', 'image_class' => 'feature','image_scan' => 'true','cache' => 'true', 'default_image' => 'http://heaven-news.net/wp-content/uploads/2012/04/noimage.jpg') ); }



?> 
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
</div>
</div>

<div id="block3">
<?php
$args = array( 'numberposts' => 1, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
$rand_posts = get_posts( $args );
foreach( $rand_posts as $post ) : ?>



<?php endforeach; ?>



<div id="ranbombarthumb3>
<?php
if (function_exists('get_the_image')){
 get_the_image( array( 'meta_key' => 'feature_img',  'width' => '110', 'height' => '120', 'image_class' => 'feature','image_scan' => 'true','cache' => 'true', 'default_image' => 'http://heaven-news.net/wp-content/uploads/2012/04/noimage.jpg') ); }



?> 
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
</div>
</div>

<div id="block4">
<?php
$args = array( 'numberposts' => 1, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
$rand_posts = get_posts( $args );
foreach( $rand_posts as $post ) : ?>



<?php endforeach; ?>



<div id="ranbombarthumb4>
<?php
if (function_exists('get_the_image')){
 get_the_image( array( 'meta_key' => 'feature_img', 'width' => '110', 'height' => '120', 'image_class' => 'feature','image_scan' => 'true','cache' => 'true', 'default_image' => 'http://heaven-news.net/wp-content/uploads/2012/04/noimage.jpg') ); }



?> 
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
</div>
</div>

<div id="block5">
<?php
$args = array( 'numberposts' => 1, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
$rand_posts = get_posts( $args );
foreach( $rand_posts as $post ) : ?>



<?php endforeach; ?>



<div id="ranbombarthumb5>
<?php
if (function_exists('get_the_image')){
 get_the_image( array( 'meta_key' => 'feature_img', 'width' => '110', 'height' => '120', 'image_class' => 'feature','image_scan' => 'true','cache' => 'true', 'default_image' => 'http://heaven-news.net/wp-content/uploads/2012/04/noimage.jpg') ); }



?> 
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
</div>
</div>
</div>

 

Άν κάποιος μπορεί να βοηθήσει θα το εκτιμούσα, γιατι έχω μπερδευτεί πολύ

Να επισημάνω οτι βάζω τον κώδικα ακριβώς πριν απο το comments template και οτι χρησημοποιώ για όλο το site το get_the_image

Eπίσης στην αρχή δέν είχα όλο αυτο το χάος αλλα είχα τον βασικό κώδικα σε ένα php file και τον καλούσα 5 φορές μέσω του get_Template_part αλλα και αυτό επίσης crashare το sidebar

Δημιουργήστε ένα λογαριασμό ή συνδεθείτε για να σχολιάσετε

Πρέπει να είστε μέλος για να αφήσετε σχόλιο

Δημιουργία λογαριασμού

Εγγραφείτε με νέο λογαριασμό στην κοινότητα μας. Είναι πανεύκολο!

Δημιουργία νέου λογαριασμού

Σύνδεση

Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ.

Συνδεθείτε τώρα
  • Δημιουργία νέου...