- This topic has 8 replies, 2 voices, and was last updated 6 years, 10 months ago by
Tom.
-
AuthorPosts
-
July 28, 2016 at 3:37 am #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 ?
July 28, 2016 at 8:58 am #213600Tom
Lead DeveloperLead DeveloperAdding 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/July 28, 2016 at 11:10 am #213646Jamyz
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 insideadd_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….
July 28, 2016 at 12:26 pm #213673Tom
Lead DeveloperLead DeveloperYou 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 π
July 28, 2016 at 12:28 pm #213676Jamyz
OK. I try this week-end. Thanks and i understand if you work.
Thanks for support.July 28, 2016 at 12:31 pm #213677Tom
Lead DeveloperLead DeveloperYou’re welcome π
July 28, 2016 at 1:47 pm #213705Jamyz
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 !!!!!July 28, 2016 at 1:57 pm #213707Jamyz
Sorry i updated with the latest WordPress now all is OK!!!
Thanks for the help….July 28, 2016 at 4:44 pm #213730Tom
Lead DeveloperLead DeveloperYou’re welcome π
-
AuthorPosts
- You must be logged in to reply to this topic.