• Home
  • About Mitch
  • Speaking
  • Articles
  • Contact
  • Home
  • About Mitch
  • Speaking
  • Articles
  • Contact

Digital Strategist

WordPress Developer

Content Creator

Unapologetic Punk

Mitch Canter

  • X
  • Bluesky
  • GitHub
  • Twitch
  • YouTube
  • LinkedIn
WordPress

Better Know a WordPress Tag: ‘siteurl’

CMDR Mitchcraft

Reading time: 1 minute

When you’re working on a development site it’s hard to set things up correctly because you know you’re going to change the site, and putting in elements that are more than likely “stationary”, such as links, will have to be changed, and that causes un-necessary headache when it comes time to move the site live.  But, in the light of wanting to make your lives easier as a developer, there is a WordPress tag that can make your life much easier: ‘bloginfo’.  the ‘bloginfo’ tag can be given various arguments to make it bend to your will.  But, one of the most useful I’ve found:

<?php bloginfo(‘siteurl’); ?>

Instead of putting links in with just a leading slash (/about/), adding <?php bloginfo(‘siteurl’); ?> will automatically append the full site url before the sub-pages. Since most developers have their dev sites as a subfolder of a current site, this allows you to skip adding the development folder before each and every URL.  It’s also good for adding links into hardcoded content, such as graphical navigation, or specially coded front-page templates.

Example code:

<a href=”<?php bloginfo(‘siteurl’); ?>”>home</a>

this link will lead you to the home page.

<a href=”<?php bloginfo(‘siteurl’); ?>/about/”>about</a>

this link (if you have custom permalinks) will take you to the about page, no matter what website or server it’s hosted on.

Bloginfo, PHP, WordPress
  • WordPress 2.7

    WordPress 2.7

    Reading time: 1 minute

    WordPress 2.7 is nothing short of amazing.  The WordPress team (and 150 others from the community) went back to the drawing board and redesigned the interface from the ground up.  It’s absolutely beautiful, and a testament to great design and an amazing user interface.  But it’s not just pretty, it’s awesome under the hood! Never…

    WordPress
  • Getting into Gutenberg, Part 2: A Knee-Jerk REACTion (and an Introduction to Gutenberg Blocks)

    Getting into Gutenberg, Part 2: A Knee-Jerk REACTion (and an Introduction to Gutenberg Blocks)

    Reading time: 4 minutes

    I wrote yesterday on Gutenberg, WordPress' soon-to-be editing experience, as it was highly mentioned at WordCampUS here in Nashville over the weekend. Yesterday, I focused specifically on the outer facade of Gutenberg – movable blocks, layouts, and modular approaches to content. Today, we're going to look at the back-end. For a WordPress developer, this is…

    WordPress