0

Hi,

I'm using a plugin in Wordpress to display events on my page, but instead of making it simple, they are requiring me to use php to display the title of the pages as I want to.

The rest of my pages display with a little icon and then the title of the page (see here: http://dev.rjthompsonmusic.com/about). This is displayed in my themes html as follows:

<i class="icon-book"></i><?php echo wpb_page_title(); ?>

But the Events Calendar plugin uses the following php to display the title on my Tour / Single Events pages (http://dev.rjthompsonmusic.com/tour):

add_filter('tribe_get_events_title', 'my_get_events_title');
function my_get_events_title($title){
if( is_tax() ){
return $title;
}else{
return 'Tour Dates';
}
}

I want the word Tour Dates in the above code to display with a calendar icon next to it (<i class="icon-calendar"></i>) and also the $title should be returned with the calendar icon next to it as well.

How can I do this?

Many thanks for any help you can offer.

R

3
Contributors
2
Replies
33
Views
4 Years
Discussion Span
Last Post by cereal
0

I don't know if there is a specific function in Wordpress to detect URI segments, or where you can set user defined functions, but you could add a conditional statement in your template to check the current section, something like:

function get_uri_segment($int = 1, $url = false)
{
    $url = $url === false ? $_SERVER['REQUEST_URI']:$url;
    $segment = explode('/',$url);

    if(array_key_exists($int,$segment))
    {
        return $segment[$int];
    }
    return false;
}

if(get_uri_segment(1) == 'tour')
{
    echo '<i class="icon-calendar"></i> '. wpb_page_title();
}
else
{
    echo '<i class="icon-book"></i> '. wpb_page_title();
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.