Viewing 15 replies - 1 through 15 (of 21 total)
  • esmi

    (@esmi)

    Assuming that it’s not something really obvious (such as a post marked private that won’t display), dropping a copy of your random script code in the pastebin might help.

    Thread Starter Sandro Dzneladze

    (@sandrodz)

    well I’m talking about category not displaying my script. on all other pages it works fine… check links I provided, and look at the sidebar on the left bottom…

    what is pastebin?

    Thread Starter Sandro Dzneladze

    (@sandrodz)

    decided to write it in a clear way. I have script that fetches random script taged as ‘featured’.

    It displays fine everywhere, except the parent category. On parent category it displays only if I;m logged in.

    esmi

    (@esmi)

    I did check the links but I couldn’t figure out where to look for the “missing” image the first time.

    The pastebin is a repository for code snippets. You paste your code into there and then drop the resulting url back here. Saves cluttering up posts with long stretches of code and often means that the code itself is much easier to read/troubleshoot.

    It does sound like there’s some sort of logic problem mixed up with the user’s login status – which is why I think we need to see the code you’re using.

    Thread Starter Sandro Dzneladze

    (@sandrodz)

    Thank you so much for looking into this! and fast replys… here is the code: http://wordpress.pastebin.ca/1399005

    It’s nothing fancy or complicated, escapes my mind why it wouldn’t work on parent category, or tag/featured/ page.

    esmi

    (@esmi)

    As you say, there’s nothing in that script that should cause it to fail. So I can only guess that it might be where you’re calling it that’s the problem. Have you tried echoing out in various places in the script?

    See http://wordpress.pastebin.ca/1400014

    It might help to pin down where it’s failing (I’m assuming it’s the sql) but the various messages should only be visible if you check the page source.

    Thread Starter Sandro Dzneladze

    (@sandrodz)

    okay checked with ur code ๐Ÿ™‚ got very strange result…

    On all pages where featured post is visible I get:

    <div style="display:none;">SELECT * FROM wp_term_relationships WHERE term_taxonomy_id = 354 ORDER BY rand() LIMIT 1</div><div style="display:none;">We have data!</div>Array
    (
        [object_id] => 12
        [term_taxonomy_id] => 354
    )
    <pre style="display:none;">1</pre>
    		 <h3>Featured Post</h3> <h2><a href="http://www.sandrophoto.com/2007/10/05/budapest-hungary/" rel="bookmark" title="Featured Post: Budapest, Hungary">Budapest, Hungary</a></h2> <p>I spent 2 years of my life in Budapest, I just wish I did more landscape photography like this… It’s an amazing city with beautiful architecture and pretty scenery.</p>
    
    <p>The first photo is a view from my dormitory room, around 6:00 AM - night of heavy drinking and no sleep, and the scene set a good mood for the hangover day <img src='http://www.sandrophoto.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
    <p><a href="http://www.sandrophoto.com/wp-content/gallery/landscapes/SuperNova.jpg" title="Budapest sky at 6:00AM. Insomnia was bothering me whole year, so I've seen some of the most beautiful paintings of nature :)" rel="lightbox[singlepic10]" ><img class="ngg-singlepic" src="http://www.sandrophoto.com/wp-content/plugins/nextgen-gallery/nggshow.php?pid=10&amp;width=336&amp;height=&amp;mode=" alt="Budapest, Hungary" title="Budapest, Hungary" /></a> <a href="http://www.sandrophoto.com/2007/10/05/budapest-hungary/#more-12" class="more-link">more photos ยป</a></p>

    on the page where it fails:

    <div style="display:none;">SELECT * FROM wp_term_relationships WHERE term_taxonomy_id = 354 ORDER BY rand() LIMIT 1</div><div style="display:none;">We have data!</div>Array
    (
        [object_id] => 38
        [term_taxonomy_id] => 354
    )
    <pre style="display:none;">1</pre>

    Thread Starter Sandro Dzneladze

    (@sandrodz)

    so basically what doesn’t work is foreach? and query post? :S very confusing…

    any suggestions?

    esmi

    (@esmi)

    We’ve proven that there’s data ready to be used for the display, so the first part of the script is fine (you could remove all those debug lines now).

    One thing bothers me – why are you using both query_posts and setup_postdata with a foreach loop?

    Can’t you use

    query_posts('p='.$row['object_id']);
    global $more;
    $more = 0;
    while (have_posts()) : the_post();?>
    	<h3>Featured Post</h3>
    	<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Featured Post: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    	<?php the_content('more photos ยป'); ?>
    <?php endwhile;?>
    Thread Starter Sandro Dzneladze

    (@sandrodz)

    Okay, took ur advice and simplified second part of the code… I’m not a coding guru, in Fact this code I created reading several wordpress support files, and example pages ๐Ÿ™‚ so basically I’m doing everything blind…

    New code: http://wordpress.pastebin.ca/1401720

    Problem is still there, when I’m logged in, it displays image on the parent category of the post, when i log out featured post disappears.

    I’m wondering, problem is the parent category only. If I add some new post to my featured tags, that category is also not displaying featured post!.

    I’m running out of ideas ๐Ÿ™

    Thread Starter Sandro Dzneladze

    (@sandrodz)

    could it be because of my theme? anything lacking in functions.php?

    avijit_sadhu

    (@avijit_sadhu)

    Even i need to do something like this but not exactly like it. I am looking to make the posts change randomly after fixed intervals of time. Any idea how i could do that. I am getting the posts using the query_posts function and setting its attribute <?php query_posts('cat=6&amp;showposts=1') ?> of showposts to 1. But how do i keep changing the posts on my sidebar??? Even if its javascript which is the solution please lend me some more help…..

    esmi

    (@esmi)

    could it be because of my theme? anything lacking in functions.php?

    Perhaps it’s where you’re calling this in your template file. Are you using category.php? Can you drop a copy of that into the pastebin?

    esmi

    (@esmi)

    @avijit_sadhu: Please start a new topic.

    Thread Starter Sandro Dzneladze

    (@sandrodz)

    yes, I use category.php… here is the content: http://pastebin.com/m733dbe9d

    doesn’t give me any clues ๐Ÿ™‚ do u see something there?

    btw, wordpress.pastebin.ca was giving me error, internal server problem, and I found com site :S

    thanks for looking into my issue, I appreciate this allot…

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘weird problem trying to show random post’ is closed to new replies.