User Tools

Site Tools


themes:template_tags

This is an old revision of the document!


Template Tags

Our themes have an extensive function list that developers and site owners can use to customize their GetSimple CMS themes. All these functions can be used anywhere in any theme file.

Echo / output functions

get_page_content()
<?php get_page_content(); ?>

Echos the page's content. No options.

getPageContent(), returnPageContent()
<?php getPageContent('slug'); ?>
<?php returnPageContent('slug'); ?>

Echos or returns slug's content (slug's URI/name as option). Use this function if you want to display certain slug's content on all pages. This function comes in handy for those, who want to have custom content boxes in template, and display them on f.e. homepage.

get_page_excerpt( $n=200, $html=false )
<?php get_page_excerpt($length, $html); ?>

Echos an excerpt of the page's content. You can also set the length of the excerpt in characters and if HTML should be included in the excerpt. $length default is 200, $html default is FALSE. Since version 2.02

get_page_meta_keywords( $echo=true )
<?php get_page_meta_keywords(); ?>

Echos/Returns the page's keywords and/or tags. No options.

get_page_meta_desc( $echo=true )
<?php get_page_meta_desc(); ?>

Echos/Returns the page's META description. No options.

Not active yet:

==get_page_meta_description( $echo=true )== <code><?php get_page_meta_description(); ?></code> Standardized alias for the get_page_meta_desc() function above. For v. 3.4

get_page_title( $echo=true )
<?php get_page_title(); ?>

Echos/Returns the page's title. No options.

get_page_clean_title( $echo=true)
<?php get_page_clean_title(); ?>

Echos/Returns the page's title, stripped of all HTML. No options.

get_page_slug( $echo=true)
<?php get_page_slug(); ?>

Echos/Returns the page's slug. No options. Example would be the word 'download' in the URL get-simple.info/download.

get_page_url( $echo=false )
<?php get_page_url(); ?>

Echos/Returns the page's full URL. Options: TRUE for “return”, FALSE or blank for “echo”. Example would be get-simple.info/

get_parent( $echo=true )
<?php get_parent(); ?>

This will echo/return the slug value of a particular page's parent

get_page_date( $i="l, F jS, Y - g:i A",$echo=true )
<?php get_page_date(); ?>, <?php get_page_date('F jS, Y'); ?>

Echos the page's last saved date. Option is not needed, but can be used for formatting: use any string combination from PHP's date function. Default format is “l, F jS, Y - g:i A”

get_header( $full=true )
<?php get_header(); ?>

Echos the page's header. No options. This automatically creates the 2 meta tags ('description', 'keywords', 'canonical' and 'generated'). If $full is FALSE, will not generate the <link rel=“canonical” …>. Place this code within your theme's <head> </head> tags. Many plugins need this tag to be in place.

<?php get_footer(); ?>

Echos the page's footer. No options. This mainly is used to introduce a plugin hook that can be called at the bottom of any template footer. Many plugins need this tag to be in place.

get_site_url( $echo=true )
<?php get_site_url(); ?>

Echos/Returns the website's domain. No options. For example, this echos get-simple.info from any page on the GetSimple website.

get_theme_url( $echo=true )
<?php get_theme_url(); ?>

Echos/Returns the website's theme directory URL. No options.

get_site_name( $echo=true )
<?php get_site_name(); ?>

Echos/Returns the website's title. Options: TRUE for “return”, leave blank for “echo”. Site name is taken from the settings page.

Not active anymore:

==get_site_email( $echo=true )== <code><?php get_site_email(); ?></code> was: Echos the administrator's email address as set in the settings page. No options. (Since Version 3.0 of GetSimple, this tag is obsolete, as there is no clear definition, whose's mail-address should be printed because of the multi-user-system)

get_site_credits( $text ='Powered by ' )
<?php get_site_credits(); ?>

Echos the string “Powered by GetSimple Version”. Option: Specify the text to prefix.

get_component($id)
<?php get_component( 'component_slug' ); ?>

Echos the component's contents. Required option is the component slug, which can be taken from the components page within the theme page.

get_navigation( $currentpage = get_page_slug(false), $classPrefix = "" )
<?php get_navigation( 'tour' ); ?>

Returns a list of pages that are added to the main menu from each of their edit screens. Required option is what is shown above. This creates a class of 'current' on the <li> element that is currently the active page. You need to supply the <ul> or <ol>. get_navigation will add a class to each menu <li> with the id of the menu items slug, if these slug classes conflict with other css rules, say generic ones such as .menu .main then you can add an optional prefix that will be prepended to the class names to make them more unique and less likely to conflict with other classes.

<?php menu_data(); ?>, <?php menu_data('page-slug'); ?>

This function outputs an array of menu specific data for developers to create their own menus instead of using the GS default get_navigation() function. If you pass it a slug of a specific page, you will only get that page's menu data.

Return Functions

return_page_title()
<?php return_page_title(); ?>

Returns the page's title. No options, since 2.0

return_page_slug()
<?php return_page_slug(); ?>

Same as get_page_slug, but it returns the slug. No options. Can be used to make page-specific IDs for CSS styling.

return_site_ver()
<?php return_site_ver(); ?>

Returns the version of GetSimple you are running. No options.

Links

Back to the GetSimple Wiki Contents Page

Pages in this Section

Themes

themes/template_tags.1404168973.txt.gz · Last modified: 2014/06/30 22:56 by shawn_a