WordPress.org

Ready to get started?Download WordPress

Forums

"Wp ajax random posts" problem with template. (3 posts)

  1. enderpal444
    Member
    Posted 2 years ago #

    I have this weird issue I can't solve with a plugin I'm using called 'wp ajax random posts". It basically allows you to create a section where you can refresh a loop of posts with a button or automatically. I have to change the function that controls the template though because I only want to show the embedded video and it's rating. The problem in this function is when I change get_the_title() with youtube_video_embed( $name, "autoplay=on&width=640&height=376" ) or the_ratings(). When I change it the first post loads and on refresh a second post loads under it and then that second post refreshes itself like it should while the first post remains overtop. I looked at the source and the iframe and the ratings appear outside of the li tags I put it in even though they are inside in the function which is the problem. So how can I fix that? Here's the function in question with the youtube function substituted for get_the_title().

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. enderpal444
    Member
    Posted 2 years ago #

    here's the pastebin for the function pastebin

  3. enderpal444
    Member
    Posted 2 years ago #

    I found a piece of code in the js that deals with destroying the post and i'm wondering if this is the issue for why it doesnt proccess the iframe inside the li tags. Here it is.

    function removeNode(obj){
    		if(typeof obj == "string")$(obj).parentNode.removeChild($(obj));
    		else obj.parentNode.removeChild(obj);
    	}

Topic Closed

This topic has been closed to new replies.

About this Topic