GetSimple Support Forum

Full Version: Output component title?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Been searching all over, but couldn't see a way to do this, so thought I would ask.

In a theme, when I have a component, I use
PHP Code:
<?php get_component('component_name'); ?>

Is it possible to include the title of the component in a theme?

So, for example, If I create a component to list some popular links, and I call it "Epic Link List", I could simply spit out the HTML behind it using

PHP Code:
<?php get_component('Epic-Link-List'); ?>

But if I didn't want to put a H4 tag in the component itself, could I in fact pull back the title separately?

Any ideas?
(not tested)
Insert this in your theme's functions.php file (create the file if it doesn't exist):

PHP Code:
function get_component_h4($compname) {
  echo 
'<h4>',$compname,'</h4>',"\n";
  
get_component($compname);


Now use this instead of get_component, like:
PHP Code:
<?php get_component_h4('Epic-Link-List'); ?>