Tagged: ,

Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #94113
    Huca
    Participant

    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

    #94154
    Pratik
    Keymaster

    @huca:
    It should work, but you should make modifications via child theme. If done so, the changes will not be lost after update.

    Regards,
    Pratik

    #94294
    Huca
    Participant

    Hi 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

    #94324
    Pratik
    Keymaster

    @huca: Thank you for the appreciation. You can add the code in child theme’s functions.php file.

    #94326
    Pratik
    Keymaster

    @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.

    #94332
    Huca
    Participant

    Thanks, 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.

    #94335
    Pratik
    Keymaster

    @huca:
    Please add this code to your child theme’s functions.php file:
    http://pastebin.com/LSqLvPD4

    If you want to remove social icons, remove lines 12 to 19 in the code.

    Let me know how it goes.

    Regards,
    Pratik

    #94340
    Huca
    Participant

    Code added, but I don´t see any change.

    #94342
    Pratik
    Keymaster

    @huca:
    Can you post in the child theme’s functions.php file? Same code is working fine on my end.

    #94343
    Huca
    Participant

    this 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
    }
    
    #94346
    Pratik
    Keymaster

    @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?

    #94348
    Huca
    Participant

    It 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.

    #94352
    Pratik
    Keymaster

    @huca: Can you try this child theme: Catch Responsive Child Theme
    I have made the changes you required here.

    #94354
    Huca
    Participant

    Amazing! 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.

    #94356
    Pratik
    Keymaster

    @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.

    #94358
    Huca
    Participant

    I have installed it via WP theme installation, then allowed the theme in the web network and activated it for the SolvePrague.

    #94362
    Pratik
    Keymaster

    @huca: I am sorry but I am not familiar with that method so I cannot comment on it.

    #94410
    Huca
    Participant

    Pratik 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

    #94412
    Pratik
    Keymaster

    @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

Viewing 19 posts - 1 through 19 (of 19 total)
  • The topic ‘Flags in header’ is closed to new replies.