Grow your CSS skills. Land your dream job.

Best way to link to other pages in wordpress

  • # December 15, 2012 at 7:40 am

    Hi guys, Just wanted to know the best way to link to other pages in wordpress.

    I have seen some do it the following ways….

    1) Absolute static URLS

    2). dynamic with page name (e.g. wp/about_us)

    3) Referencing page ID’s (e.g index.php?page_id=15)

    I just wanted to know which is the best method, or any other recommended method which I have not included above.

    Thanks in advance

    # December 15, 2012 at 7:59 am

    I think it’s down to personal preference really, but I prefer to have my permalink structure set like this;

    sitename.co.uk/about

    sitname.co.uk/portfolio

    I think it just looks neater as opposed to the other types, like I said. It’s just a matter of opinion.

    # December 15, 2012 at 4:55 pm

    If you’re talking about links coded into a theme, and not inserted via the WYSIWYG editor, Then use [get_permalink($post->ID);](http://codex.wordpress.org/Function_Reference/get_permalink)

    # December 15, 2012 at 5:09 pm

    @Watson90 is correct, link to the absolute urls and keep them consistent (don’t use multiple versions). I would however disagree about the “personal preference” part, there are good reasons to use them.

    In one of your examples ( wp/about_us ), never use underscores in URL structures, and ultimately the keep everything in URL structures as simple as possible, “about-us”, is better as just “about”

    Now the index.php?page_id=15 method is terrible, it isn’t useful to users and would be bad for SEO.

    # December 15, 2012 at 5:11 pm

    I agree with Scott. Personally, I think the us part in About Us is pointless. Same thing with Contact Us.

    # December 15, 2012 at 6:21 pm

    I say absolute static URL’s, so if your content is ever scraped it’ll point back to the original source (your website).

    # December 15, 2012 at 6:43 pm

    Thanks for the feedback guys. Totally agree with your comments.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".