-
AuthorPosts
-
September 12, 2014 at 9:24 pm #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, 3 months ago by czar.
September 13, 2014 at 9:22 am #318439any suggestions?
September 14, 2014 at 4:16 am #318718Hey!
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!
JosueSeptember 14, 2014 at 7:26 am #318803Thanks 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/thanks
- This reply was modified 10 years, 3 months ago by czar.
September 15, 2014 at 4:50 am #318991Hi!
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,
JosueSeptember 15, 2014 at 1:58 pm #319181Thanks 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">
September 15, 2014 at 6:46 pm #319345Hey!
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,
JosueSeptember 15, 2014 at 10:48 pm #319470Thanks Josue, perhaps it is easier to insert at this point a widget area? I can insert shortcode in this…
thnksSeptember 15, 2014 at 11:33 pm #319483Hi!
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!
JosueSeptember 16, 2014 at 1:07 pm #319766Hi Josue, just that I copy page.php on child theme to change?
but how do I add this shortcode in the page?
[city_name]
September 17, 2014 at 1:56 am #320234Hey!
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_shortcodeBest regards,
JosueSeptember 17, 2014 at 5:50 pm #320639` ok thanks Josue
-
AuthorPosts
- The topic ‘edit 'Title page' in header’ is closed to new replies.