• Hi Gang,

    I’m sure that what I need is simple but I have not been able to locate an example on the web. I am modifying a theme and need to customize the previous and next post buttons to use the client’s images. I know that I need to use the <?php previous_post_link(‘« %link’) ?> tags in my theme but these tags just generate text links.

    Is it possible to put that tag somewhere in a normal javascript rollover for a graphical button and get the desired tag function results? Can anyone point me at an example or a page I can view source on? Thanks in advance for any help you can provide.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Try styling the links using CSS.

    Thread Starter chrisboggs

    (@chrisboggs)

    Thanks for the quick response Esmi. I have taken your suggested approach with partial success. When I click on the link buttons I get reffered back to the current post and not the previous or next posts. I’m sure it’s my ignorance of php. I am including the button code here:

    <div id="prev_post_button">
        	<ul>
            	<li>
                	<a href="<?php get_previous_post() ?>"></a>
                </li>
            </ul>
        </div>
    
        <div id="next_post_button">
        	<ul>
            	<li>
                	<a href="<?php get_next_post() ?>"></a>
           	    </li>
            </ul>
        </div>

    Should I be passing some sort of arguments in the wp php tags? In the Codex function example area there are no examples showing correct use. Do you see any obvious errors I’m making? The post in question is linked below:

    https://www.chrisboggs.com/scott/wordpress_dev/banking_and_finance_subset/another-work-example-3

    I sncerely appreciate yours or anyone else’s help. Seriously.

    The code looks OK. Perhaps something else in your template is causing problems.

    Thread Starter chrisboggs

    (@chrisboggs)

    Really all I need is an example of a button someone has done with ‘<?php get_previous_post() ?>’ that uses a physical appearance customized in css or with an image and not just the raw text out put of that tag!!! I’ve been looking all over the web for any example of this to no avail. I simply will not believe I am the first person to do this on the web, lol! I’m at a loss as to what to do except hope against hope that I will find some sort of example somewhere. I think I will start downloading themes and installing them to see if any have similar next post / prev post buttons and how they did it. That’s all I can think of.

    Has anyone solved this one yet? I styled the links to look like buttons using CSS (just a simple button background, nothing fancy) and the buttons are showing up blank if there are no posts available for Previous or Next. I was going to replace it with button images but I keep breaking the code.

    Here’s what I have:

    <div class="flt"><div class="button_articles" align="center"><?php next_posts_link(__('&laquo; Past Article', 'default')) ?></div></div>

    My stylesheet has a button_articles class just with the button background image….

    Any takers?

    you can check for the case if there are no next or prev articles, and then show an alternative which you might be able to style with your buttons:

    example:

    <div class="navigation">
    			<div class="alignleft"><?php if(get_next_posts_link()) { next_posts_link('&laquo; Older Entries'); } else { echo 'No Older Entries'; } ; ?></div>
    
    			<div class="alignright"><?php if(get_previous_posts_link()) { previous_posts_link('Newer Entries &raquo;'); } else { echo 'No Newer Entries'; } ; ?></div>
    		</div>

    OH COOL. I’ll give it a try later today, that’s what I was searching for. Thanks alchymyth! I appreciate the super fast reply (it’s been driving me nuts for 2 days!)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom image Previous and Next post buttons’ is closed to new replies.