Jared Heinrichs

  • Technology Blog
  • Winnipeg Computer Repair
  • Winnipeg Photographer
  • Cooking With Jared
You are here: Home / Web Applications / Wordpress / Wordpress functions that you will typically use

Oct 28, 2009 By Jared Heinrichs Leave a Comment

WordPress functions that you will typically use

This post will go over the functions that I tend to use quite often when designing WordPress themes. As I find out and use more I will update this page as needed.

List of the main Functions for all parts of a WordPress page:

<?php get_header(); ?>
<?php have_posts(); ?>
<?php the_content(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

URL for default style sheet in WordPress which is located: (http://server/wp-content/themes/theme_name/style.css )

<?php bloginfo('stylesheet_url'); ?>

 

The name of the website name:

<?php bloginfo('name'); ?>

 

The root of the theme directory. ( http://server/wp-content/themes/theme_name/ )

<?php bloginfo('template_url')?>

 

Root of the wordpress site:

<?php echo get_option('home'); ?>

 

The title of the page/post:

<?php the_title(); ?>

 

Next/Previous Post Link functions:

<?php nex_posts_link('Older Entries') ?>
<?php previous_posts_link('Newer Entries') ?>

 

The content of the page/post:

<?php the_content('&lt;p class="serif">Read the rest of this page &raquo;</p>'); ?>

 

Display the category decription:

<?php echo category_description( $category ); ?>

 

The time at which the page/post was posted

<?php the_time('l, F jS, Y') ?>

 

Display the pages of the WordPress website. You can also include or exclude certain pages:

<?php wp_list_pages(); ?>
<?php wp_list_pages("title_li=&include=2,3,22,41"); ?>
<?php wp_list_pages("title_li=&exclude=2,3,22,41"); ?>

*NOTE* to find out what the page number is log into WordPress admin section and go to the “Pages” section. If you hover over the “Page Title” at the bottom of the webpage in the status bar you can tell what the page number is ( If anyone knows how to do this any better please let me know ) :

image

image

 

How to limit the number of posts in “the loop”. In this example I chose I wanted to only show 4 posts per page. I went even further by telling the “Query_posts” to only look for category 17 which on my website is my recipe category. This line MUST be inserted BEFORE “the loop”.

<?php query_posts("cat=17&showposts=4") ?>

Eternal Info

*NOTE* If you can’t find what you need here you can always check out check out the Official WordPress Function Reference page.

Filed Under: Wordpress

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Board Game Rules
  • Camera
  • Computer Hardware
    • Blackberry
    • drivers
    • iPad
    • Magic Jack
    • USB
  • Damn Small Linux
  • Exam Notes
  • Facebook
  • FREE Flashcards
  • Games
    • PC
      • League of Legends
    • Wii
    • xbox 360
  • Music
  • Networking
    • Cisco Certification
    • Mitel
    • Palo Alto Firewall
  • News
    • Google
    • Microsoft
  • Operating System
    • Active Directory (2003)
    • Android
    • Command Prompt
    • Damn Small Linux
    • Group Policy
    • Hyper-V
    • IIS
    • ISA 2006
    • Mac OS X
    • Microsoft Exchange Server
    • Powershell
    • Security
    • SME Server
    • Terminal Server 2003
    • Ubuntu Linux
      • Adito Web SSL VPN
      • OpenVpn-als
      • Webmin
    • Virtual Machine Manager
    • Windows 2003 SBS
    • Windows 2003 Server
    • Windows 2008
    • Windows 2008 R2
    • Windows 2012R2
    • Windows 7
    • Windows 8
    • Windows Command Line
    • Windows Deployment Services
    • Windows Server Backup
    • Windows Vista
    • Windows XP
  • Phones
  • Photography
  • Photos
    • Animals
    • Misc
    • Nature
    • Portraits
  • Portfolio
  • Programming
    • CSS
    • HTML
    • jQuery
    • MySQL
    • PHP
    • Script
  • Programs
    • Acrobat
    • Acrobat Reader
    • Adobe Dreamweaver
    • Adobe Illustrator
    • Adobe Photoshop
    • Anti-virus Software
    • Antivirus
    • Backup Exec
    • Bittorent
    • Blackberry BESADMIN
    • Internet Explorer 9
    • Lightroom
    • Microsoft Office
    • Netbeans
    • Onenote
    • Outlook
    • Shelby
    • Sysprep
    • Trend
    • Video Editing
    • Visual Studio
    • Windows Live Writer
    • WireShark
    • XP Mode
    • Zarafa
  • Recipe
  • Review
  • Software Links
  • Troubleshooting
  • Uncategorized
  • Videos
  • Web Applications
    • Brage
    • Google
    • Spiceworks
    • Wordpress
  • Web Browsers
    • Internet Explorer
  • Web Server
    • XAMPP
  • Winnipeg
    • ISP

Try searching this site!

Copyright © 2019 Winnipeg Web Design