GetSimple Support Forum
Output component title? - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Output component title? (/showthread.php?tid=4039)



Output component title? - skedster - 2012-12-20

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?


RE: Output component title? - Carlos - 2012-12-20

(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'); ?>