Saturday, May 19, 2012

How to make wordpress Templates

Posted by admin On April - 24 - 2010 ADD COMMENTS

When we talk about the wordpress templates  its to customize the look of  wordpress themes , if we want to make the page looks  different from the   regular pages  then we assign  a page  templates  for a particular  page .page  templates are needed to give   professional look of the  web site and  , page   templates allow easy customization of pages  and  a look totally  on our wish .its   good way to make  custom pages.well  templates is good way to make professional look.. lets learn  here  how to  make it

to make a  template we need  to assign a name of the   templates as that wordpress recognize it

<?php

/*

Template Name:forum

*/

<div id=”casing”>

get_header();

if(have_posts())while(have_posts()){the_post();the_content();}

</div>

get_footer();

?>

this is simple  page template   named  forum.php

if we  want to make page template from  the  default page  template   then  open –> page.php file  of  wordpress theme

put the template name  on the top of the  code  after php tag

<?php

/*

Template Name:forum

*/

rest of the code………

?>

now  save it as   as   the name of the  template here use   forum.php

Now giving example   of existing  code    page.php

<?php get_header(); ?>

<div id=”foxmenucontainer”>

<div id=”menu”>

<ul>

<?php wp_list_categories(’sort_column=name&title_li=&depth=4′); ?>

</ul>

</div>

</div>

<div id=”casing”>

<div id=”content”>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div id=”post-<?php the_ID(); ?>”>

<div>

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h2>

</div>

<div>

<div>

<?php the_content(‘Read the rest of this entry &raquo;’); ?>

<div></div>

<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages: </strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

</div>

</div>

</div>

<?php endwhile; endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

now we  make it as page  templates   test.php  by editing  code and  removing the code that we not want on the   to see   in the page  .


<?php

/*

Template Name:test

*/

get_header(); ?>

<div id=”foxmenucontainer”>

<div id=”menu”>

<ul>

<?php wp_list_categories(’sort_column=name&title_li=&depth=4′); ?>

</ul>

</div>

</div>

<div id=”casing”>

<div id=”content1″>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div>

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h2>

</div>

<div>

<div>

<?php the_content(‘Read the rest of this entry &raquo;’); ?>

<div></div>

<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages: </strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

</div>

</div>

<?php endwhile; endif; ?>

</div>

<?php get_footer(); ?>

upload in the theme directory  and  assign the page template for  any page we wish .

<?php

/*

Template Name:forum

*/

<div id=”casing”>

get_header();

if(have_posts())while(have_posts()){the_post();the_content();}

</div>

get_footer();

?>

this is simple  page template   named  forum.php

if we  want to make page template from  the  default page  template   then  open –> page.php file  of  wordpress theme

put the template name  on the top of the  code  after php tag

<?php

/*

Template Name:forum

*/

rest of the code………

?>

now  save it as   as   the name of the  template here use   forum.php

Now giving example   of existing  code    page.php

<?php get_header(); ?>

<div id=”foxmenucontainer”>

<div id=”menu”>

<ul>

<?php wp_list_categories(’sort_column=name&title_li=&depth=4′); ?>

</ul>

</div>

</div>

<div id=”casing”>

<div id=”content”>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div id=”post-<?php the_ID(); ?>”>

<div>

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h2>

</div>

<div>

<div>

<?php the_content(‘Read the rest of this entry &raquo;’); ?>

<div></div>

<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages: </strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

</div>

</div>

</div>

<?php endwhile; endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

now we  make it as page  templates   test.php  by editing  code and  removing the code that we not want on the   to see   in the page  .


<?php

/*

Template Name:test

*/

get_header(); ?>

<div id=”foxmenucontainer”>

<div id=”menu”>

<ul>

<?php wp_list_categories(’sort_column=name&title_li=&depth=4′); ?>

</ul>

</div>

</div>

<div id=”casing”>

<div id=”content1″>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div>

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h2>

</div>

<div>

<div>

<?php the_content(‘Read the rest of this entry &raquo;’); ?>

<div></div>

<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages: </strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

</div>

</div>

<?php endwhile; endif; ?>

</div>

<?php get_footer(); ?>

upload in the theme directory  and  assign the page template for  any page we wish .

Popularity: 19% [?]

The Best cms wordpress

Posted by admin On April - 24 - 2010 ADD COMMENTS

when  we talk abou the best cms ( content management system )  for websites , then many   cms  under gpl comes  like wordpress, drupal, joomla, frog and many more and  still developing ,   now the question comes  out of many cms  which one is the best cms  , its totally based on the   uses ,  what type of  site  you want to build , i worked in many cms  but the easy  and  powerful cms  i saw is wordpress .

the best thing of  wordpress  is  its  having  a good coding standard , themes can be easily customized  and  you will  get  many plugins  from wordpress  website: www.wordpress.org also you  will get  many themes  form wordpress  website and even the support you need  to build the website

today  i will discuss on  wordpress website   from  installation  to set up:

1. download the  wordpress  latest version of wordpress  from the worpress website  www.wordpress.org

2.  download the zip format   yet  i am  not going for tar.gz  files  , unzip the  it

3. via ftp  upload the files  into  www folder  if you  using cpanel   and if using  parallel pro  use  public_html  folder  both are  same ,  ie we need to upload it to the root folder  if we  want it to visible as    www.yoursite.com  ,  you can even install it on subfolder based   on your need  .the  the access url will be  www.yoursite.com/foldername , even you can install it on sub domain  set the subdomain from the  cpanel  and  when u create the sub domain a folder is  automatically  formed   and  only  you need to upload the files to it.

4. now  login to your  cpanel   and  make  database for it , click on databases –> create new data base –>a nd  after doing this  –> create new  user its on the same  page –> now  associate the user and   database its on the  lower end of the same page (remmeber the password).

now   here is four things need  to rememeber

a. database name

b database  user  name

c password

d host ( mostly its localhost)

5. now   open the wordpress folder  there  you can see  the  wp-config-sample.php file –> edit this  file you can open in a text editor  like  notepad

// ** MySQL settings – You can get this info from your web host ** //

/** The name of the database for WordPress */

define(‘DB_NAME’, ‘putyourdbnamehere’);     — >  put the databasename  in place of   putyourdbnamehere

/** MySQL database username */

define(‘DB_USER’, ‘usernamehere’);   –> put the  database username   in  place of  usernamehere

/** MySQL database password */

define(‘DB_PASSWORD’, ‘yourpasswordhere’);    –>  put the database  user  password  in place  of  yourpasswordhere

/** MySQL hostname */

define(‘DB_HOST’, ‘localhost’);

edit this  section  to set the configuration   for  success database connectivity  put the required  fields ,

There is also    some other  fields

Here  i am giving the  fields  only replace the  authentication  values   with the key generated from the wordpress site

http://api.wordpress.org/secret-key/1.1/

* Authentication Unique Keys.

define(‘AUTH_KEY’, ‘put your unique phrase here’);

define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);

define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);

define(‘NONCE_KEY’, ‘put your unique phrase here’);

Now upload the  wp-config.php   via ftp to  www folder  .

Now  access the domain   www. your sitename.com   , and  now setup will  come   if any error in wp-config.php found then it will show error  in database connectivity else the setup will start and  you need to give the name of the blog  and email in case if you forget your website  , well we can make it any way to blog  and even modify to any  good site   based on our skill.

Now  copy the password  and access the  site   after you access it  come to USER section and  click on profile and  change the  password  of  what you like.

The installation is done  and now  you need to  put themes  you like(www.web2feel.com is  place where  you will get good themes )  in   www/contents/themes/   folder  and activate the theme via the admin panel and  similary  if like any plugins  you want to add  put it in side www/contents/plugins  folder and activate  via wordpress admin panel. now its  done  and   configure the  site based on your   need  .

Popularity: 10% [?]

Wordpress User Role Explained

Posted by admin On April - 24 - 2010 ADD COMMENTS

You have a role of doing something wherever you are at or at whichever position you are, those roles are pre-defined and involve certain things that you can do and cannot do, some times we do break rules, however with software we usually cannot.

Likewise with WordPress there are some roles that are pre-defined and have certain capabilities that you can use to assign to members of your site, in this post we will look at those roles and know what each of them mean.

Subscriber Role

What is Subscriber Role?

A subscriber role is the most basic and default role that is assigned to any user that registers to the site, unless you of course change that by tweaking the settings.

A subscriber can comment on your blog without having to enter their details and also modify your database by setting up their profiles.

Best Practices for Subscriber Role?

Subscriber role is suited best for users whom you want to register to your site and comment without having to enter their details everytime, in addition to that you can also use this role to promote special offers and more, but it may require additional coding or plugins.

Subscriber Role in WordPress;

  • Modify their Profiles
  • Comment on the blog (when logged in) without having to provide name and email, unless you change that in the settings.

Who Should You Assign Subscriber Role to?

Subscriber Role can be open to everyone who wants to save sometime while entering their details over and over again while commenting and various other things you reserve for subscribers, however they need to be logged in, this role is best suited for every user on your site, and every other roles on your site has all the capabilities that this user has.

Contributor Role

Who is a Contributor?

A Contributor to your site has a bigger role than a regular subscriber in the sense that they can compose articles unlike subscribers, however they cannot publish or schedule the articles.

Any article written by a contributor can be saved as draft or under pending review which we will look at when we deal with “Types of Posts a WordPress site can have and what it means”.

A contributor can only contribute towards the site, however they do not have rights to publish a article.

Best Practices for Contributor Role?

A contributor role is best given to someone who wants to contribute to your site by adding new articles, but which you would like to go over before publishing.

Contributor Role In WordPress;

  • All of the Subscribers privileges+
  • View comments in the administrator panel.
  • Add new posts to drafts or to pending review.
  • Edit their own posts.
  • View posts added by others in post listing section, however they cannot view drafts and scheduled post, but they can see the titles.

Who Should You Assign Contributor Role to?

Contributor roles should be assigned to those users who want to post articles to your site, however you still need to go over them before you publish them, this means that everything they write will go through you before it hits your site.

Author Role

Who is a Author?

Author is a well known term and it has the same meaning in WordPress, a author can write articles, add it up as pending review, save it under drafts but more importantly they can publish what they write.

Yes publish it, which means, whoever you assign an author role can publish articles to the site without having your consent.

Best Practices for Author Role

You can give the role of an author to people who can add and publish articles to the site without having to ask for your review, once you give a role of a author they do not have to go through the pending preview cycle to publish, so you might not have a control over what gets published.

This role requires a bit of trust as they can publish anything (not explained) to your site without your knowledge.

Author Role in WordPress;

  • All of the Contributor privileges+
  • View posts added by others in post listing section, however they cannot view drafts and scheduled post, but they can see the titles.

Who Should You Assign Author Roles To?

In a hierarchy you would always want to go through top level, however once you assign a role of a author to someone, it bypasses that and it does not require checks, so you should only assign this role to people who you trust can write good articles for your site, if you feel otherwise you should always put them in the contributor role.

Editor Role

The Editor role can do all of the above, but in addition to that, they can edit other’s post (which is what a editor does) and change anything in anyone else’s post, however WordPress logs who edited which post and when (if you have post reviews on), so you need to turn post revision onwhich we will look at in future posts.

However when you assign the role of an editor to someone, you virtually give control over everything that is published on your blog to them, so do this very carefully and thoughtfully.

WordPress does not have a role between an author and a editor which is really wanted, but you can actually restrict roles by using several plugins.

Who Should You Assign Editor Roles To?

If an author can write and publish articles, an editor can write articles, publish them, edit them, they can do the same for any other author or editor on the site, this means that the person whom you assign as a editor has all the rights except for administrative which we will see next.

This role should only be assigned when you are entirely sure you want to do it and except for administrative privileges it has every other privileges a newspaper or magazine editor has.

Administrator Role

I have a key to your house and I can do anything with it, virtually a administrative role is just like that, once you assign a role of a admin to someone, they can do as they like, so this role should *NEVER* be assigned to anyone other than yourself, if you do need to do that, make sure you assign it to someone who you trust.

An administrator account can DELETE your entire blog, they can DELETE all comments, in short they can ruin everything you created in couple of clicks.

That aside an admin user on a WordPress blog is responsible for upgrading the blog, upgrading plugins, moderating comments among other things that all of the above roles add up to, so this is a role you should never assign to anyone (not explained) unless you are certain of what you are doing.

Who Should You Assign Admin Roles To?

No one, unless you are really sure what you want to do with your blog.

Which Role Can Be Used and When In Simple Words

  • A subscriber role should be used when you want people who comment on your blog to not enter their information over and over again.
  • A contributor role should be used when you want your subscribers to contribute to your site, but don’t want to directly publish articles to your site.
  • An author role should be used when you trust a contributor or someone you think will write the best, without you having to go through what they wrote.
  • An editor role should only be given to people who you trust to write, edit and publish not just their own articles but those of other’s too.
  • An administrator role should never be given to anyone other than yourself, this is the most critical role and can rule the roost, and it does, but only if you hold it yourself.

Popularity: 6% [?]

google Analytics to wordpress Theme footer

Posted by admin On April - 20 - 2010 ADD COMMENTS

Every blogger in the blogosphere is aware of the Google’s tracking service , Google Analytics. It is an essential tool to monitor the site traffic details and performance statistics. Anybody can setup an analytics account for free with their Google account. Users will be a given a unique js tracking snippet, which can be inserted to the website. When it comes to WordPress blogs, there are numerous plugins available for enabling analytics tracking on the blog.

But here we are going to see how to add the analytics script to the site template, ideally to the footer using your functions.php file.
The process is very simple, and only requisite is that the footer file should have the

<?php wp_footer(); ?>

To get started, you need to open the functions.php file in your theme on any text editor. Then add the following php snippet to it.

<?php function add_google_analytics() { ?>

<script src=”http://www.google-analytics.com/ga.js” ></script>

<script >

var pageTracker = _gat._getTracker(“UA-XXXXX-X”);

pageTracker._trackPageview();

</script>

<?php }

add_action(‘wp_footer’, ‘add_google_analytics’);

?>


Once added don’t forget to change the “UA-XXXXX-X” to your own unique tracking code.

# Remember : This process is template specific. If you added this to one template and later switch to another template, remember to add this script to its functions.php file also, to continue tracking.

Popularity: 2% [?]

Customize Wordpress 2.9 excerpts

Posted by admin On April - 18 - 2010 ADD COMMENTS

In WordPress themes, you would see the homepage displaying blocks of post excerpts. These excerpts are generated using the template tag

<?php the_excerpt(); ?>

By default this template tag returns the first 55 words of the post’s content. This teaser is generated only if you have not specified any custom excerpt from your post editor section. But what if you want to display more than 55 words on your excerpts? Simple, just add the following code to your theme function.php file. It will return first 100 words of post’s content.

function new_excerpt_length($length) {

return 100;

}

add_filter(‘excerpt_length’, ‘new_excerpt_length’);

What about the [...] string at the end of excerpt
By default WordPress excerpts shows a [...] string at the end of the excerpt. what if you want to change this to a link. something like [Read More] which links to full post view.To do that just add the following code to your functions.php file.

function new_excerpt_more($more) {

return ‘<a href=”‘. get_permalink($post->ID) . ‘”>’ . ‘ [Read More]‘ . ‘</a>’;

}

add_filter(‘excerpt_more’, ‘new_excerpt_more’);

Reference: WordPress Codex

Popularity: 4% [?]

Excecuting php code on wordpress post/pages

Posted by admin On April - 18 - 2010 ADD COMMENTS

The Exec-PHP plugin executes PHP code in posts, pages and text widgets.

Features:

  • Executes PHP code in the excerpt and the content portion of your posts and pages
  • Configurable execution of PHP code in text widgets (for WordPress 2.2 or higher)
  • Write PHP code in familiar syntax, eg. <?php ... ?>
  • Works in your newsfeeds
  • Information about which users are allowed to execute PHP with the current security settings (for WordPress 2.1 or higher)
  • Configurable user warnings for inappropriate blog and user settings (for WordPress 2.1 or higher)
  • Restrict execution of PHP code in posts and pages to certain users by using roles and capabilities
  • Update notifications through the ‘Plugins’ menu in WordPress if a new version of the Exec-PHP plugin is available (for WordPress 2.3 or higher)
  • Internationalization support (english and german included, many more available)
  • Comes with documentation


For support and further information about the Exec-PHP plugin see the plugins homepage at http://bluesome.net/post/2005/08/18/50/.

Popularity: 3% [?]

improve your SEO potential

For most people the upcoming holiday season will be one for relaxing and spending quality time with the family. But, [...]

Open source CMS

nomey
Cross-platform
Anomey is a small but effective framework and CMS for developing and maintaining web sites. (GPL)
BIGACE
Cross-platform
BIGACE is a multi-site, multi-language and [...]

Web Development / Frameworks

Bitweaver
Cross-platform
Bitweaver is a free and open source web application framework and content management system. (LGPL)
CakePHP
Cross-platform
CakePHP is a rapid development framework for [...]

Web Development Utilities

CKeditor
Cross-platform
This HTML text editor brings to the web much of the power of desktop editors like MS Word. It’s lightweight [...]

TAG CLOUD


Fatal error: Call to undefined function get_theme_option() in /home/sitescod/public_html/wp-content/themes/chronicle/footer.php on line 14