[Resolved] GeneratePress + Mantle Update (Save some code)

Home Forums Support [Resolved] GeneratePress + Mantle Update (Save some code)

Home Forums Support GeneratePress + Mantle Update (Save some code)

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #213520
    Jamyz

    Hi i have GeneratePress with Mantle.
    But everytime y update GeneratPress or Mantle some code are deleted.

    In Mantle style.css a have this code adding, at bottom

    /* DEBUT CODE JAMYZ */
    .main-navigation .site-logo {
      display: none;
      float: left;
      line-height: 20px; /* Adjust this to your menu item height */
      margin-right: 1.5em;
      margin-top: 5px;
    }
    .stickynav .main-navigation .site-logo {
        display: block;
    }
    
    .inside-header {
      position: relative;
    }
    
    .social {
          position: absolute;
          left: 10px;
          bottom: 5px;
    }
    
    div.image {
          position: absolute;
          right: 10px;
          bottom: 0px;
    }
    
    /* DEBUT CODE TAILLES POLICES ONGLET*/
    .main-navigation a {
    font-size: 17px!important;
    }
    /* FIN CODE TAILLES POLICES ONGLET */
    .sidebar .widget-title {
    text-align: center;
    }
    /* FIN CODE JAMYZ */

    In GeneratePress functions.php a have this code adding, at bottom

    /*DEBUT CODE JAMYZ*/
    add_action('generate_inside_navigation','generate_navigation_logo');
    function generate_navigation_logo()
    {
    ?>
    <div class="site-logo">
    <a href="http://www.perthes-en-gatinais.fr/"><img src="http://www.perthes-en-gatinais.fr/wp-content/uploads/2014/06/cropped-cropped-65px-Blason_ville_fr_Perthes_Seine-et-Marne.svg_31.png" alt="" /></a>
    </div>
    <?php
    }
    function enable_custom_mime_types( $mimes ) {
    $mimes['swf'] = 'application/x-shockwave-flash';
    return $mimes;
    }
    add_filter( 'upload_mimes', 'enable_custom_mime_types' );
    /*FIN CODE JAMYZ*/

    GeneratePress Header.php

    <?php
    /**
     * The Header for our theme.
     *
     * Displays all of the <head> section and everything up till <main id="main">
     *
     * @package GeneratePress
     */
    ?><!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    	<meta charset="<?php bloginfo( 'charset' ); ?>">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
    	<?php if ( ! function_exists( '_wp_render_title_tag' ) ) : ?>
    		<title><?php wp_title( '|', true, 'right' ); ?></title>
    	<?php endif; ?>
    	<link rel="profile" href="http://gmpg.org/xfn/11">
    	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    	<?php wp_head(); ?>
    </head>
    
    <body itemtype="http://schema.org/WebPage" itemscope="itemscope" <?php body_class(); ?>>
    	<?php do_action( 'generate_before_header' ); ?>
    	<a class="screen-reader-text skip-link" href="#content" title="<?php esc_attr_e( 'Skip to content', 'generate' ); ?>"><?php _e( 'Skip to content', 'generate' ); ?></a>
    	<header itemtype="http://schema.org/WPHeader" itemscope="itemscope" id="masthead" role="banner" <?php generate_header_class(); ?>>
    		<div <?php generate_inside_header_class(); ?>>
    			<?php do_action( 'generate_before_header_content'); ?>
    			<?php generate_header_items(); ?>
    			<?php do_action( 'generate_after_header_content'); ?>
    		</div><!-- .inside-header -->
    
    <div class="social">
      <?php echo do_shortcode('[aps-social id="1"]')?>
    </div>
    
    <div class="image">
          <a href="http://www.perthes-en-gatinais.fr/nous-contacter/" >
             <img id="image" src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/e-mail-enveloppe-icone-5361-40.png'
             onmouseover="this.src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/nous-contacter-e1436188546745.png';"
             onmouseout="this.src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/e-mail-enveloppe-icone-5361-40.png';"/>
          </a>
    </div>
    
    	</header><!-- #masthead -->
    <?php do_action( 'generate_after_header' ); ?>	
    	<div id="page" class="hfeed site grid-container container grid-parent">
    		<div id="content" class="site-content">
    			<?php do_action('generate_inside_container'); ?>

    How many i can save all after an update of both themes ?

    #213600
    Tom
    Lead Developer
    Lead Developer

    Adding CSS and functions can be done like this:
    https://generatepress.com/knowledgebase/adding-css/
    https://generatepress.com/knowledgebase/adding-php-functions/

    Adding template files requires the child theme I’m afraid, so you wouldn’t be able to update.

    However you could hook that extra content you’ve added into header.php into the generate_after_header_content hook: https://generatepress.com/knowledgebase/hook-list/

    #213646
    Jamyz

    Thanks i installed Simple CSS.
    I add

    /* DEBUT CODE JAMYZ */
    .main-navigation .site-logo {
      display: none;
      float: left;
      line-height: 20px; /* Adjust this to your menu item height */
      margin-right: 1.5em;
      margin-top: 5px;
    }
    .stickynav .main-navigation .site-logo {
        display: block;
    }
    
    .inside-header {
      position: relative;
    }
    
    .social {
          position: absolute;
          left: 10px;
          bottom: 5px;
    }
    
    div.image {
          position: absolute;
          right: 10px;
          bottom: 0px;
    }
    
    /* DEBUT CODE TAILLES POLICES ONGLET*/
    .main-navigation a {
    font-size: 17px!important;
    }
    /* FIN CODE TAILLES POLICES ONGLET */
    .sidebar .widget-title {
    text-align: center;
    }
    /* FIN CODE JAMYZ */

    I installed Pluginception & Code Snippets.
    But i don’t understand how many i use both.
    I create a plugin named entente-perthes.php with this inside

    add_action( 'generate_after_header_content', 'EntetePerthes' );
    function your_function_name()
    { ?>
    <div class="social">
      <?php echo do_shortcode('[aps-social id="1"]')?>
    </div>
    
    <div class="image">
          <a href="http://www.perthes-en-gatinais.fr/nous-contacter/" >
             <img id="image" src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/e-mail-enveloppe-icone-5361-40.png'
             onmouseover="this.src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/nous-contacter-e1436188546745.png';"
             onmouseout="this.src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/e-mail-enveloppe-icone-5361-40.png';"/>
          </a>
    </div>
    <?php }

    Now what i do with Code Snippet ???? I need a example to understand. if that possible. Thanks….

    #213673
    Tom
    Lead Developer
    Lead Developer

    You almost have it.

    If the add_action call you named the function you’re hooking: EntetePerthes

    However, the function below is named: your_function_name

    Those two need to match, then it should work πŸ™‚

    #213676
    Jamyz

    OK. I try this week-end. Thanks and i understand if you work.
    Thanks for support.

    #213677
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

    #213705
    Jamyz

    Done thanks for the help.
    I finale create 2 plugin.
    For helping people
    one is

    <?php
    /*
    Plugin Name: Pertes - Functions.php - Entete Logo
    Plugin URI: 
    Description: 
    Version: 1
    Author: Jamyz
    Author URI: http://www.jamyz.com
    License: FREE
    License URI: 
    */
    /*DEBUT CODE JAMYZ*/
    add_action('generate_inside_navigation','generate_navigation_logo');
    function generate_navigation_logo()
    {
    ?>
    <div class="site-logo">
    <a href="http://www.perthes-en-gatinais.fr/"><img src="http://www.perthes-en-gatinais.fr/wp-content/uploads/2014/06/cropped-cropped-65px-Blason_ville_fr_Perthes_Seine-et-Marne.svg_31.png" alt="" /></a>
    </div>
    <?php
    }
    function enable_custom_mime_types( $mimes ) {
    $mimes['swf'] = 'application/x-shockwave-flash';
    return $mimes;
    }
    add_filter( 'upload_mimes', 'enable_custom_mime_types' );
    /*FIN CODE JAMYZ*/

    the other

    <?php
    /*
    Plugin Name: Pertes - Icones Social
    Plugin URI: 
    Description: 
    Version: 1
    Author: Jamyz
    Author URI: http://www.jamyz.com
    License: FREE
    License URI: 
    */
    
    /*DEBUT CODE JAMYZ*/
    add_action('generate_after_header_content','generate_after_header_content');
    function generate_after_header_content()
    { ?>
    <div class="social">
      <?php echo do_shortcode('[aps-social id="1"]')?>
    </div>
    
    <div class="image">
          <a href="http://www.perthes-en-gatinais.fr/nous-contacter/" >
             <img id="image" src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/e-mail-enveloppe-icone-5361-40.png'
             onmouseover="this.src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/nous-contacter-e1436188546745.png';"
             onmouseout="this.src='http://www.perthes-en-gatinais.fr/wp-content/uploads/2015/07/e-mail-enveloppe-icone-5361-40.png';"/>
          </a>
    </div>
    <?php }
    /*FIN CODE JAMYZ*/

    Finally i updated Mantle & GeneratePress, all of before is save but when i go in plugins i can’t update GP Premium the arrows doesn’t stop???

    What is the problem ?
    Thanks you !!!!!

    #213707
    Jamyz

    Sorry i updated with the latest WordPress now all is OK!!!
    Thanks for the help….

    #213730
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.