Skip to main content
added 19 characters in body
Source Link
Krzysiek Dróżdż
  • 25.5k
  • 9
  • 53
  • 74

You can do it like so, I guess:

<div class="alignleftfp">
    <?php next_post_link('%link', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> %title'); ?>
</div>
<div class="alignrightfp">
    <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" />'); ?>
</div>

PS. You shouldn't use next_post/previous_post functions - they're deprecated.

EDIT

Just read the_content filter docs. It SHOULD NOT echo anything. It should return it's value. So your function should look like this:

function nextprev($content) {
    ob_start(); ?>
    <div class="alignleftfp">
        <?php next_post_link('%link', '<img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/5.png" alt="Next" /> %title'); ?>
    </div>
    <div class="alignrightfp">
        <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/6.png" alt="Next" />'); ?>
    </div>
    <?php $my_next_prev = ob_get_flushob_get_contents(); ob_end_clean();
   
    return $content . $my_next_prev;
}

add_action('the_content','nextprev');

You can do it like so, I guess:

<div class="alignleftfp">
    <?php next_post_link('%link', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> %title'); ?>
</div>
<div class="alignrightfp">
    <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" />'); ?>
</div>

PS. You shouldn't use next_post/previous_post functions - they're deprecated.

EDIT

Just read the_content filter docs. It SHOULD NOT echo anything. It should return it's value. So your function should look like this:

function nextprev($content) {
    ob_start(); ?>
    <div class="alignleftfp">
        <?php next_post_link('%link', '<img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/5.png" alt="Next" /> %title'); ?>
    </div>
    <div class="alignrightfp">
        <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/6.png" alt="Next" />'); ?>
    </div>
    <?php $my_next_prev = ob_get_flush();
   
    return $content . $my_next_prev;
}

add_action('the_content','nextprev');

You can do it like so, I guess:

<div class="alignleftfp">
    <?php next_post_link('%link', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> %title'); ?>
</div>
<div class="alignrightfp">
    <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" />'); ?>
</div>

PS. You shouldn't use next_post/previous_post functions - they're deprecated.

EDIT

Just read the_content filter docs. It SHOULD NOT echo anything. It should return it's value. So your function should look like this:

function nextprev($content) {
    ob_start(); ?>
    <div class="alignleftfp">
        <?php next_post_link('%link', '<img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/5.png" alt="Next" /> %title'); ?>
    </div>
    <div class="alignrightfp">
        <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/6.png" alt="Next" />'); ?>
    </div>
    <?php $my_next_prev = ob_get_contents(); ob_end_clean();
   
    return $content . $my_next_prev;
}

add_action('the_content','nextprev');
added 862 characters in body
Source Link
Krzysiek Dróżdż
  • 25.5k
  • 9
  • 53
  • 74

You can do it like so, I guess:

<div class="alignleftfp">
    <?php next_post_link('%link', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> %title'); ?>
</div>
<div class="alignrightfp">
    <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" />'); ?>
</div>

PS. You shouldn't use next_post/previous_post functions - they're deprecated.

EDIT

Just read the_content filter docs. It SHOULD NOT echo anything. It should return it's value. So your function should look like this:

function nextprev($content) {
    ob_start(); ?>
    <div class="alignleftfp">
        <?php next_post_link('%link', '<img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/5.png" alt="Next" /> %title'); ?>
    </div>
    <div class="alignrightfp">
        <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/6.png" alt="Next" />'); ?>
    </div>
    <?php $my_next_prev = ob_get_flush();
   
    return $content . $my_next_prev;
}

add_action('the_content','nextprev');

You can do it like so, I guess:

<div class="alignleftfp">
    <?php next_post_link('%link', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> %title'); ?>
</div>
<div class="alignrightfp">
    <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" />'); ?>
</div>

PS. You shouldn't use next_post/previous_post functions - they're deprecated.

You can do it like so, I guess:

<div class="alignleftfp">
    <?php next_post_link('%link', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> %title'); ?>
</div>
<div class="alignrightfp">
    <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" />'); ?>
</div>

PS. You shouldn't use next_post/previous_post functions - they're deprecated.

EDIT

Just read the_content filter docs. It SHOULD NOT echo anything. It should return it's value. So your function should look like this:

function nextprev($content) {
    ob_start(); ?>
    <div class="alignleftfp">
        <?php next_post_link('%link', '<img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/5.png" alt="Next" /> %title'); ?>
    </div>
    <div class="alignrightfp">
        <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_PLUGIN_URL . '/testplugin/assets/type1/6.png" alt="Next" />'); ?>
    </div>
    <?php $my_next_prev = ob_get_flush();
   
    return $content . $my_next_prev;
}

add_action('the_content','nextprev');
Source Link
Krzysiek Dróżdż
  • 25.5k
  • 9
  • 53
  • 74

You can do it like so, I guess:

<div class="alignleftfp">
    <?php next_post_link('%link', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> %title'); ?>
</div>
<div class="alignrightfp">
    <?php previous_post_link('%link', '%title <img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" />'); ?>
</div>

PS. You shouldn't use next_post/previous_post functions - they're deprecated.