Support » Themes and Templates » Help with AJAX

  • Hello everybody,

    I am about to finish building a child theme for P2. I am not interested in changing any of the functionalities since it’s just perfect for my use.. so it’s all about the look and feel.

    To make the post box looks special, I had to add some divs/spans around the main < li > element in entry.php. The final result is something like:

    <span class="my-post-topedge"></span>
    <li id="prologue-<?php the_ID(); ?>" <?php post_class( get_the_author_meta( 'ID' ) ); ?>>
    	<div class="my-post-leftedge">
    	<div class="my-post-content">
    		<?php if ( !is_page() ) : ?>
    		<?php endif; ?>
    	</div> <!-- .my-post-content -->
    	<span class="my-post-bottomedge"></span>
    	</div> <!-- .my-post-leftedge -->

    As you can see, there is a span outside that shows the top edge of the box, plus two divs inside that show the left edge and the background for the box content, respectively. (yes, you guess it! the right edge is the li’s background it-self) Finally, there is a span at the end that shows the bottom edge of the box.

    The problem now is the AJAX, which I really have no idea about, unfortunately. When adding a new post, the only element that is being load is the < li >, without all of the others divs/spans. As a result, the loaded post looks horrible without refreshing the page.
    If there was an easy change I can made to make it loads those elements, then I will really appreciate if anyone let me know about it. Otherwise, I’ll have to live with it!


Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Ipstenu (Mika Epstein)


    Lead Plugin Wrangler

    Dunno why you tagged it for me. I’m not an AJAX expert by any means (nor do I acutally use P2…. nor am I the worlds best themer… that would probably be Esmi, when it comes to theme support 😉 )

    Untagging cause I don’t know either.



    Forum Moderator

    It sounds like you’d have to amend the AJAX script to some extent. But, personally, I think your current code looks like it’s suffering from divitis. I don’t know P2 at all but I’d be curious to see the output without your extra divs and spans. There may be existing hooks that you could re-use – otherwise you could be in for a lot of Ajax re-editing.

    @ipstenu I am sorry. I thought you can help. Anyway, thank you for bringing the expert 😛

    @esmi Here is the original file (entry.php):
    [Code moderated as per the Forum Rules. Please use the pastebin]

    As you can see, there is a new div! That is because I found later that I need to assign a special background to the li element when using the key shortcuts feature of the theme (there are shortcuts to go through the next/previous post, which need some highlight effect for the post you chose).




    Forum Moderator

    I need to see the site itself.

    Just sent you an email.

    Sorry to be annoying, but did you have any chance to check it?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Help with AJAX’ is closed to new replies.