Wordpress and Webdesign Forum go41 » WordPress Code Snippets

  1. Blogchick
    Member

    Ever since I started writing posts with this theme, I've been using a code that makes the links dotted. I like the look better than the normal link formatting.

    However, my understanding of css is very VERY basic, so I never figured out how to add the change into the style sheet itself. So, to achieve the effect, I've always just added the code into the posts themselves. Here's what that looks like.

    Ever since I started writing posts, I've been using a code that makes the links dotted. I like the look better than the normal link formatting.

    However, my understanding of css is very VERY basic, so I never figured out how to add the change into the style sheet itself. So, to achieve the effect, I've always just added the code into the posts themselves. Here's what that looks like.

    Surely there must be a way to add the change to the style sheet itself. And now I'm wondering how.

    Back then, I tried adding the code to the section:

    a:link, a:visited {

    }

    but that didn't work.

    Basically, I'm tired of always copying the code into posts and now that I've started using smaller laptop to update the blog, things become more and more cluttered with the screen being so small. What are your thoughts?

    Posted 2 years ago #
  2. if you start to change something in style.css under
    a:link, a:visited {
    color: #3c78a7;
    text-decoration:none
    }

    a:hover, a:active {
    color: #3c78a7;
    text-decoration:underline;
    }
    you will get this changes all over your site, let's say you change
    text-decoration:none
    to
    text-decoration:underline
    in the a:link part, all your links in your site will be underlined by default, on hover with the mouse will be no change (unless you make this to text-decoration:none

    I understand you want to change links you show in your posts only, so you could use new entries:
    .post a {
    text-decoration:underline;
    color:#FF0000;
    }
    .post a:hover {
    color: #3c78a7;
    }
    this will underline all links in posts AND make them red as example, on hover the links will change to blue as before.

    So did you ever make an ftp connection to your site to just pull the whole thing as a backup to your PC?
    Where is your site?

    Posted 2 years ago #
  3. Blogchick
    Member

    That worked out perfectly! Thanks Joern :).

    Posted 2 years ago #
  4. I got at least one more idea how to 'improve' your internal linking by giving the visitors a chance to go directly from one post to the next in single post view. Just display the link to next and previous post on the bottom of each post.

    For this open up your single.php where you find at the end:

    <?php endif; ?>
    
    	</div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    After the endif and before the next /div place the navigation code to look like this:

    <?php endif; ?>
    			<div class="navigation">
    				<div class="right"><?php next_post_link('%link &raquo;') ?></div>
    				<div class="left"><?php previous_post_link('&laquo; %link') ?></div>
    			</div>
    	</div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    you should get now the titles and link to next and previous posts.

    Posted 2 years ago #
  5. Blogchick
    Member

    Hi Joern,

    Thanks for the brilliant suggestion! I think it's a great idea and implemented a slight variation of it.

    What I didn't like was the location though - putting that code in exactly like that would have the next and previous links show up all the way down the page just under the IntenseDebate section, which I think is an area that doesn't usually get much attention.

    So, instead I put it just above the comments section. Quick question though, is there a way to have it show the next/previous post in that particular category (instead of the next/previous post by date)?

    Posted 2 years ago #
  6. I think yes, you can limit this next and previous to the categories the post is in.

    I do not know how this works really with posts in asigned to many categories, but this should do it:

    <div class="navigation">
    		<div class="right"><?php next_post_link('%link &raquo;', '%title', TRUE) ?></div>
    		<div class="left"><?php previous_post_link('&laquo; %link', '%title', TRUE) ?></div>
    	</div>
    Posted 2 years ago #
  7. Blogchick
    Member

    That did it.... now all of the next and previous posts are within the categories. Well, not with the featured and heading categories (which behave funny), but I have no problem with that really.

    Thanks again :).

    Posted 2 years ago #
  8. what happened to your single.php?
    I guess you have a /div too much close to the end of this file.
    The sidebar drops below the content.

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Join us! or log in (lost password?):