Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #318332

    Hi, which file I have to edit to change ‘Title page’ in header? I want to replace it with one of my php variable

    $current_location = geodir_get_current_location(); echo $current_location ;

    thanks

    • This topic was modified 10 years, 2 months ago by czar.
    #318439

    any suggestions?

    #318718

    Hey!

    Try adding this at the very end of your theme functions.php file:

    add_filter('avf_title_args', 'avia_change_title', 10, 2);
    
    function avia_change_title($args, $id)
    {
    $current_location = geodir_get_current_location();
    $args['title'] = $current_location;
    return $args;
    }

    Cheers!
    Josue

    #318803

    Thanks Josue, it works, but in the wrong position and without formatting. see picture.
    it is also possible for this function to exclude blog section?
    link: http://www.sfogliacitta.it/

    title head

    thanks

    • This reply was modified 10 years, 2 months ago by czar.
    #318991

    Hi!

    I think that may be happening because the geodir_get_current_location is directly echoing the result, you’d need to fix that on your end. Regarding limiting this mod to certain pages you can do the following:

    add_filter('avf_title_args', 'avia_change_title', 10, 2);
    
    function avia_change_title($args, $id)
    {
    	if(!is_page(22)){
    		$current_location = geodir_get_current_location();
    		$args['title'] = $current_location;
    	}
    	return $args;
    }

    22 being the ID of the blog page.

    Cheers,
    Josue

    #319181

    Thanks Josue, but this also affects the position?
    Word Milano is in: <div id = "main" data-scroll-offset = "88">
    and not in: <h1 class = "main-title entry-title">

    head

    #319345

    Hey!

    If you change the code to this:

    add_filter('avf_title_args', 'avia_change_title', 10, 2);
    
    function avia_change_title($args, $id)
    {
    	if(!is_page(22)){
    		//$current_location = geodir_get_current_location();
    		$args['title'] = "Something Else";
    	}
    	return $args;
    }

    Does “Something Else” appears inside .main-title or #main?

    Regards,
    Josue

    #319470

    Thanks Josue, perhaps it is easier to insert at this point a widget area? I can insert shortcode in this…
    thnks

    #319483

    Hi!

    That’s possible but it would require some custom work, you’d need to tweak page.php, line 10.

    if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
    

    Cheers!
    Josue

    #319766

    Hi Josue, just that I copy page.php on child theme to change?

    but how do I add this shortcode in the page?

    [city_name]

    #320234

    Hey!

    Yes, copying page.php to the child folder will work. Regarding how to execute a shortcode in PHP, refer to this:
    http://codex.wordpress.org/Function_Reference/do_shortcode

    Best regards,
    Josue

    #320639

    ` ok thanks Josue

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘edit 'Title page' in header’ is closed to new replies.