WordPress.org

Ready to get started?Download WordPress

Forums

Smarter Navigation
[resolved] can I add smart navigation with javascript? (3 posts)

  1. rrswans
    Member
    Posted 2 years ago #

    I am trying to insert my <?php previous_post_smart('%link', 'next'); ?> and <?php next_post_smart('%link', 'previous'); ?> links in-between two areas in the content section of all my single.php posts. In my template I can choose between putting these tags after all the content of before it, but not in the middle.

    So I tried adding the buttons with javascript using the append() function. This did not work. The buttons seem to only work when placed directly in the single.php file.

    Is there anyway I can dynamically add these buttons and keep their functionality? This was the javascript (query) I was using.

    $('#singleheadingdescription').append("<div id="nextPrevContainer"><span class="prev"><?php previous_post_smart('%link', 'next'); ?></span><span class="next"><?php next_post_smart('%link', 'previous'); ?></span></div>
    ");

    http://wordpress.org/extend/plugins/smarter-navigation/

  2. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    You can put the template tags below the content and then move them to the middle with .appendTo().

  3. rrswans
    Member
    Posted 2 years ago #

    Thanks that worked great!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic