Tagged: polylang
- This topic has 18 replies, 2 voices, and was last updated 8 years, 4 months ago by Pratik.
-
AuthorPosts
-
June 23, 2016 at 1:16 pm #94113HucaParticipant
Hi,
I would like to place polylang flags in the Catch responsive header. Based on Polylang instruction I should place this code in the header:
- <?php pll_the_languages(array(‘show_flags’=>1,’show_names’=>0));?>
but I don´t really want to break the layout + I don´t know if it remains in the same place after template update.
thanks for help,
Petr
June 24, 2016 at 9:37 am #94154PratikParticipant@huca:
It should work, but you should make modifications via child theme. If done so, the changes will not be lost after update.Regards,
PratikJune 27, 2016 at 8:39 pm #94294HucaParticipantHi Pratik,
in general thanks a lot for helping me. I really appreciate that. In this case, where exactly in the header I should put the mentioned code?
Thanks a lot,
Petr
June 28, 2016 at 11:51 am #94324PratikParticipant@huca: Thank you for the appreciation. You can add the code in child theme’s functions.php file.
June 28, 2016 at 11:54 am #94326PratikParticipant@huca: Sorry, I thought this was another post. You can create a function and hook the above code. Let me know where exactly in header you want the flags to appear and I will provide you the code for it.
June 28, 2016 at 12:13 pm #94332HucaParticipantThanks, would be nice to have it
1) under the search field, where is currently placed the Facebook button (we would remove the Facebook button then)
if not possible
2) between SolvePrague text and search field. Basically in the middle of the header – horizontally and vertically.
Thanks a lot.
June 28, 2016 at 12:39 pm #94335PratikParticipant@huca:
Please add this code to your child theme’s functions.php file:
http://pastebin.com/LSqLvPD4If you want to remove social icons, remove lines 12 to 19 in the code.
Let me know how it goes.
Regards,
PratikJune 28, 2016 at 1:17 pm #94340HucaParticipantCode added, but I don´t see any change.
June 28, 2016 at 2:05 pm #94342PratikParticipant@huca:
Can you post in the child theme’s functions.php file? Same code is working fine on my end.June 28, 2016 at 2:08 pm #94343HucaParticipantthis is the whole function.php code, since I was also making some other changes from another thread, where you help me. But none of these actually works, so maybe I did something somewhere wrong?
<?php /** * Child Theme functions and definitions * */ /** * Loading Parent theme stylesheet * */ add_action( 'wp_enqueue_scripts', 'catchresponsive_child_enqueue_styles' ); function catchresponsive_child_enqueue_styles() { wp_enqueue_style( 'catchresponsive-parent-style', get_template_directory_uri() . '/style.css' );} if ( ! function_exists( 'catchresponsive_polylang_invalidcache' ) ) : /** * Template for Clearing Polylang Invalid Cache * */ function catchresponsive_polylang_invalidcache() { delete_transient( 'catchresponsive_featured_slider' ); } // catchresponsive_polylang_invalidcache endif; add_action( 'after_setup_theme', 'catchresponsive_polylang_invalidcache' ); /** * Get the logo and display * * @uses get_transient, catchresponsive_get_theme_options, get_header_textcolor, get_bloginfo, set_transient, display_header_text * @get logo from options and make it polylang compatible * * @display logo * * @action * * @since Catch Responsive 1.0 */ function catchresponsive_site_branding() { $options = catchresponsive_get_theme_options(); $catchresponsive_site_logo = ''; //Checking Logo if ( function_exists( 'has_custom_logo' ) ) { if ( has_custom_logo() ) { $custom_logo_id = get_theme_mod( 'custom_logo' ); $image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); $catchresponsive_site_logo = ' <div id="site-logo"> <a href="' . esc_url( pll_home_url() ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" rel="home"> <img src="' . esc_url( $image ) . '" alt="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '"> </a> </div><!-- #site-logo -->'; } } else if ( '' != $options['logo'] && !$options['logo_disable'] ) { $catchresponsive_site_logo = ' <div id="site-logo"> <a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" rel="home"> <img src="' . esc_url( $options['logo'] ) . '" alt="' . esc_attr( $options['logo_alt_text'] ). '"> </a> </div><!-- #site-logo -->'; } $catchresponsive_header_text = ' <div id="site-header"> <h1 class="site-title"><a href="' . esc_url( home_url( '/' ) ) . '">' . get_bloginfo( 'name' ) . '</a></h1> <h2 class="site-description">' . get_bloginfo( 'description' ) . '</h2> </div><!-- #site-header -->'; $text_color = get_header_textcolor(); $catchresponsive_site_branding = '<div id="site-branding">'; $catchresponsive_site_branding .= $catchresponsive_header_text; if ( function_exists( 'has_custom_logo' ) ) { if ( has_custom_logo() ) { if ( ! $options['move_title_tagline'] && 'blank' != $text_color ) { $catchresponsive_site_branding = '<div id="site-branding" class="logo-left">'; $catchresponsive_site_branding .= $catchresponsive_site_logo; $catchresponsive_site_branding .= $catchresponsive_header_text; } else { $catchresponsive_site_branding = '<div id="site-branding" class="logo-right">'; $catchresponsive_site_branding .= $catchresponsive_header_text; $catchresponsive_site_branding .= $catchresponsive_site_logo; } } } else if ( '' != $options['logo'] && !$options['logo_disable'] ) { if ( ! $options['move_title_tagline'] && 'blank' != $text_color ) { $catchresponsive_site_branding = '<div id="site-branding" class="logo-left">'; $catchresponsive_site_branding .= $catchresponsive_site_logo; $catchresponsive_site_branding .= $catchresponsive_header_text; } else { $catchresponsive_site_branding = '<div id="site-branding" class="logo-right">'; $catchresponsive_site_branding .= $catchresponsive_header_text; $catchresponsive_site_branding .= $catchresponsive_site_logo; } } $catchresponsive_site_branding .= '</div><!-- #site-branding-->'; echo $catchresponsive_site_branding ; } /** * Function to override parent function */ function catchresponsive_header_right() { ?> <aside class="sidebar sidebar-header-right widget-area"> <section class="widget widget_search" id="header-right-search"> <div class="widget-wrap"> <?php echo get_search_form(); ?> </div> </section> <?php if ( '' != ( $catchresponsive_social_icons = catchresponsive_get_social_icons() ) ) { ?> <section class="widget widget_catchresponsive_social_icons" id="header-right-social-icons"> <div class="widget-wrap"> <?php echo $catchresponsive_social_icons; ?> </div><!-- .widget-wrap --> </section><!-- #header-right-social-icons --> <?php } ?> <?php if ( function_exists( 'pll_the_languages' ) ) { ?> <section class="widget"> <div class="widget-wrap"> <?php pll_the_languages( array( 'show_flags' => 1, 'show_names' => 0 ) );?> </div><!-- .widget-wrap --> </section><!-- #header-right-social-icons --> <?php } ?> </aside><!-- .sidebar .header-sidebar .widget-area --> <?php }
June 28, 2016 at 2:22 pm #94346PratikParticipant@huca:
Yes pretty strange as all the code seems ok, but about the file name, it should be functions.php so it is not taking the codes, can you check?June 28, 2016 at 2:37 pm #94348HucaParticipantIt is. It is also placed in the child theme folder and child theme is active, but none of these changes actually appear on the frontend. It´s really weird.
June 28, 2016 at 2:59 pm #94352PratikParticipant@huca: Can you try this child theme: Catch Responsive Child Theme
I have made the changes you required here.June 28, 2016 at 3:54 pm #94354HucaParticipantAmazing! It works. The only weird thing is that I don´t see the child theme when accessing via ftp in wp-content – themes to be able to make some additionally changes.
June 28, 2016 at 4:17 pm #94356PratikParticipant@huca: I am glad it worked out. The child theme should be there. If it is not in the wp-content folder, the you must have the wrong folder/wp installation. Please check it.
June 28, 2016 at 4:27 pm #94358HucaParticipantI have installed it via WP theme installation, then allowed the theme in the web network and activated it for the SolvePrague.
June 28, 2016 at 4:52 pm #94362PratikParticipant@huca: I am sorry but I am not familiar with that method so I cannot comment on it.
June 29, 2016 at 12:15 pm #94410HucaParticipantPratik I have found out the bug on my site. I have multisite feature running on my WP installation, which was the reason some changes did not appear on the frontend. It all works now and I would like to thank you very much. I really appreciate you help and patience.
I am buying pint of beer for you as soon as you visit Prague 🙂
Thanks a lot!
Petr
June 29, 2016 at 12:48 pm #94412PratikParticipant@huca: 😀 I am glad everything was solved.
I doubt I will be visiting Prague, but if I do, I will take you up on that beer 😀
If you liked our theme and support, please leave us a review at https://wordpress.org/support/view/theme-reviews/catch-responsive.
Regards,
Pratik -
AuthorPosts
- The topic ‘Flags in header’ is closed to new replies.