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

  1. rrswans
    Posted 3 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>


  2. scribu
    Plugin Author

    Posted 3 years ago #

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

  3. rrswans
    Posted 3 years ago #

    Thanks that worked great!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Smarter Navigation
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic