PHP useful in wordpress

PHP useful in wordpress

In this guide I'm going to put some PHP tags are very useful when making your wordpress templates, they will be divided into:

Useful anywhere on the templates: These are codes that you can call from any php file of your templates.

Useful in "the loop" code specifically useful for the section called loop, which is what allows you to call the entries.

Useful anywhere on the templates:

a) language Attributes: Displays the default language for your blog (such en-GB or en-EN)

  1
  ; ?> <? Php language_attributes ();?> 

b) Description of the blog: Displays the description of your blog (set when creating the same)

  1
  'description' ) ?> <? Php bloginfo ('description')?> 

c) Blog Name: Displays the name of your blog (configured when creating the same)

  1
  'name' ) ; ?> <? Php bloginfo ('name');?> 

d) Style of your theme: Displays the URL of the stylesheet of your theme

  1
 'stylesheet_url' ) ; ?> <? Php bloginfo ('stylesheet_url');?> 

e) Your blog RSS: Displays the address of your blog RSS

  1
  'rss2_url' ) ; ?> <? Php bloginfo ('rss2_url');?> 

d) your blog Pingback: Displays the URL of your blog Pingback

  1
  'pingback_url' ) ; ?> <? Php bloginfo ('pingback_url');?> 

e) Header: Shows some header data (required for many Plugins)

  1
  ; ?> <? Php wp_head ();?> 

f) URL for your blog: Displays the URL of your blog.

  1
  get_option ( 'home' ) ; ?> <? Php echo get_option ('home');?> 

and also serves the following

  1
  'url' ) ; ?> <? Php bloginfo ('url');?> 

g) Call template files: You can call from anywhere in your template file, another file to load. (For example, since the file called sidebar search)

  1
  ( TEMPLATEPATH . '/nombre_de_archivo.php' ) ; ?> <? Php include (TEMPLATEPATH. '/ Nombre_de_archivo.php');?> 

h) Current Date: Displays the current date

  1
  'l, F jS, Y' ) ; ?> <? Php the_time ('l, JS F, Y');?> 

i) List of pages: Displays a list of pages published

  1
  'title_li=<h2>Pages</h2>' ) ; ?> <? Php wp_list_pages ('title_li = <h2> Pages </ h2>');?> 

j) File List: Displays a list of files published (monthly).

  1
  'type=monthly' ) ; ?> <? Php wp_get_archives ('type = monthly');?> 

k) List of Categories: Displays a list of all your blog caractegorias

  1
  'show_count=1&amp;title_li=<h2>Categories</h2>' ) ; ?> <? Php wp_list_categories ('show_count = 1 & title_li = <h2> Categories </ h2>');?> 

l) Registration Link: Displays the link for your users to register.

  1
  ; ?> <? Php wp_register ();?> 

m) Logon Link: Displays the link for your users log on.

  1
 ; ?> <? Php wp_loginout ();?> 

n) WordPress Version: Displays the current version you use WordPress

  1
  'version' ) ; ?> <? Php bloginfo ('version');?> 

ñ) RSS Comments: Shows the URL for the RSS of comments

  1
  'comments_rss2_url' ) ; ?> <? Php bloginfo ('comments_rss2_url');?> 

o) footer Files: Calls to some important cosigos footer (important for some plugins)

  1
  ; ?> <? Php wp_footer ();?> 

p) Call header: Call the file header.php

  1
  ; ?> <? Php get_header ();?> 

q) Call sidebar: Call the sidebar.php file

  1
 ; ?> <? Php get_sidebar ();?> 

r) Call footer: Call the footer.php file

  1
  ; ?> <? Php get_footer ();?> 

s) html type: Displays the type html used on your website, for example text / html

  1
  'html_type' ) ; ?> <? Php bloginfo ('html_type');?> 

t) Charset: Shows the Charset of your website.

  1
  'charset' ) ; ?> <? Php bloginfo ('charset');?> 

u) User: Displays the name of the user visiting the blog (Only when logged out)

  1
  $user_identity ; ?> <? Php echo $ user_identity;?> 

v) Tags allowed: Displays a list of html tags allowed in comments

  1
 allowed_tags ( ) ; ?> <? Php echo allowed_tags ();?> 

w) Calendar: Displays a calendar

  1
  ; ?> <? Php get_calendar ();?> 

x) Board of style: Displays an automatic route to the place where your style, eg http://www.tupagina/wp-content/themes/tutema/css/

  1
  'stylesheet_directory' ) ; ?> <? Php bloginfo ('stylesheet_directory');?> 

y) Directory theme displayed with a route to the address of your theme, for example, http://www.tupagina.com/wp-content/themes/tutema

  1
  'template_directory' ) ; ?> <? Php bloginfo ('template_directory');?> 

Useful in the Loop

a) Open Loop code which opens the loop

  1
  ( have_posts ( ) ) : ?> <? Php if (have_posts ()):?> 

b) Close the loop: code that closes the loop

  1
 ; ?> <? Php endif;?> 

c) post ID: Displays the number characteristic of the post (id)

  1
  ; ?> <? Php THE_A ();?> 

d) Permalink: Displays the URL of the entry

  1
  ?> <? Php the_permalink ()?> 

e) Title of entry: Displays the title of the post

  1
  ; ?> <? Php the_title ();?> 

f) Date of post: Displays the date of publication of the post

  1
  'F jS, Y' ) ?> <? Php the_time ('F js, Y')?> 

g) The author of the entry: Displays the author of the post

  1
  ?> <? Php the_author ()?> 

h) Content of the entry: Displays the contents of the entry

  1
  'Leer el resto de la entrada &amp;raquo;' ) ; ?> <? Php the_content ('Read the rest of the entry &raquo;');?> 

i) Extract of entry: Public input extract

  1
  'Leer el resto de la entrada &amp;raquo;' ) ; ?> <? Php the_excerpt ('Read the rest of the entry &raquo;');?> 

j) Post tags: Sample entry labels

  1
 'Etiquetas: ' , ', ' , '<br />' ) ; ?> <? Php the_tags ('Tags:', ',', '<br />');?> 

k) Category of post: Displays the categories of post

  1
  ', ' ) ?> <? Php the_category ('')?> 

l) Link of edition: Shows a link to (only seen by the administrator) to easily edit the entry

  1
 'Editar' , '' , ' . ' ) ; ?> <? Php edit_post_link ('Edit','', '.');?> 

m) Comments: Shows post comments

  1
  'Sin comentarios &amp;#187;' , '1 Comentario &amp;#187;' , '% Comentarios &amp;#187;' ) ; ?> <? Php comments_popup_link ('No Comments &#187;', '1 Comment &#187; ','% Comments &#187; ');?> 

n) Open the entry: Code which opens the door

  1
  ( have_posts ( ) ) : the_post ( ) ; ?> <? Php while (have_posts ()): the_post ();?> 

n) Close the entry: Code which closes the entrance

  1
  ; ?> <Php endwhile;?> 

o) Check old: Shows a link to older posts

  1
 '&amp;laquo; Entradas Antiguas' ) ?> <? Php next_posts_link ('&laquo; older posts')?> 

p) New Entries: Shows a link to the new entries

  1
  'Entradas nuevas &amp;raquo;' ) ?> <? Php previous_posts_link ('Check new &raquo;')?> 

q) comentarios.php File: Call the page comentarios.php (Required to display the comments of a post.

  1
  ; ?> <? Php comments_template ();?> 

r) Entry Previous: Displays a login link to the previous posts

  1
  '%' , '' , 'yes' , 'yes' ) ; ?> <? Php previous_post ('%','', 'yes', 'yes');?> 

s) Next Entry: Shows a link to the entry appers after you see.

  1
 '%' , '' , 'yes' , 'yes' ) ; ?> <? Php next_post ('%','', 'yes', 'yes');?> 
Constant Update

Michael is the creator and editor of skyandstars.net which publishes guides and tutorials for WordPress, CuteNews, PHP, HTML and more. Are a current college student.

Mijael166

Maybe one of these entries may interest you

6 Responses to "PHP useful in wordpress"

  1. kpricornium

    October 23, 2009

    Excellent, thanks

  2. maisa

    November 26, 2009

    very useful!
    and I changed to wordpress (I have anywhere else xD qe)

  3. Mijael166

    November 26, 2009

    Heyy is cheating .... Tiens to leave the link xD Greetings linda

  4. maisa

    November 27, 2009

    aca ajaj this
    http://paramoredaily.com/

  5. Michael

    November 27, 2009

    That: P then all to visit the website of maisa: p Greetings

Trackbacks

  1. Create a theme for wordpress | Webnivel

Leave a comment

Name (Required)

Email (required but not published)

Web

Comment (Required)

* Your E-mail is used to relate it to your account in Gravatar