Community News – Custom Templates

With the latest version of the Community News plugin, customizing the templates had been brought to a whole new level.
It is true that you are not able to simple edit the looks in your WP-Admin anymore, but instead there are simple PHP templates included with the plugin that you can easily modify.

Preparation

Before it is possible to start creating your own, custom, templates; a few things have to be done. This is necessary in order to keep your modifications while updating to a later version of the plugin.
Don’t worry, these steps are nothing more then copying, pasting and renaming a directory.

Preparation Steps

  1. First go to the plugin directory, usually /wp-content/plugins/fv-community-news/.
  2. Copy the Template directory.
  3. Go to your themes directory, usually /wp-content/themes/.
  4. Paste the Template directory here, and rename it to fvcn
  5. You can start editing the template files, located in the fvcn directory, now.

Template Files

Located in the directory you just created, there are a few PHP files. These are the template files you can modify. A brief description of each file will follow below:

form-widget.php
Displays the form in a widget.

form.php
Displays the form.

list-posts-widget.php
Displays the most recent posts in a widget.

list-posts.php
Displays the most recent posts.

posts-archive.php
Displays a complete archive of all the posts ever submitted.

So if, for example, you would like to change the looks of the recent posts in your sidebar widget; you will have to modify list-posts-widget.php.

Template Functions

With version 2.0 and up, the plugin has build-in template tags, very similar to the WordPress ones you use in your themes. You can use these functions to customize the default templates.

Post Functions
These functions can be used to render anything related to a submitted post.

fvcn_has_posts($args)

fvcn_posts()

fvcn_the_post()

fvcn_get_post_id()

fvcn_post_id()

fvcn_get_post_author()

fvcn_post_author()

fvcn_get_post_author_email()

fvcn_post_author_email()

fvcn_get_post_status()

fvcn_post_status()

fvcn_get_post_author_ip()

fvcn_post_author_ip()

fvcn_get_post_title()

fvcn_post_title()

fvcn_get_post_content()

fvcn_post_content()

fvcn_get_post_excerpt()

fvcn_post_excerpt()

fvcn_get_post_url()

fvcn_has_post_url()

fvcn_post_url()

fvcn_get_post_link($text)

fvcn_post_link($text)

fvcn_get_post_title_link()

fvcn_get_post_date($format)

fvcn_post_date($format)

fvcn_get_post_views()

fvcn_post_views()

fvcn_get_post_approved()

fvcn_post_approved()

fvcn_get_post_approve_link()

fvcn_post_approve_link()

fvcn_get_post_unapprove_link()

fvcn_post_unapprove_link()

fvcn_get_post_edit_link()

fvcn_post_edit_link()

fvcn_get_post_spam_link()

fvcn_post_spam_link()

fvcn_get_post_unspam_link()

fvcn_post_unspam_link()

fvcn_get_post_delete_link()

fvcn_post_delete_link()

Form Functions
Use these functions to create the submission form.

fvcn_get_form()

fvcn_form()

fvcn_get_form_message()

fvcn_form_message()

fvcn_form_processed()

Render Functions
These functions render a complete section.

fvcn_list_posts()

fvcn_post_archives()

Various Functions
Other functions.

fvcn_get_rss_url()

fvcn_rss_url()

More information on these functions will soon be available.
All these functions are located in the file fv-community-news/Includes/TemplateFunctions.php. You can view this file for more information on these functions as well.

Wordpress Plugins
, ,