Balisage hn

WRInaute discret
Bonsoir
J'aimerais corriger le balisage h des pages de mon site .
Il ya des incohérences dans mon code source :
Par exemple : un h3 sur le menu et un h6 sur "catégories".

Comment corriger cet anomalie ?
Quel fichier dois je vérifier ?

Merci
 
WRInaute accro
Le fichier qui génère le menu....

(au cas où ça ne t'aurait pas effleuré l'esprit il y a des centaines de CMS différents, avec chacun des centaines de thèmes....)
 
WRInaute discret
Comment faire en sorte que le menu ne soit plus en h3?
Quelle modification faire ?merci d'avance

Code:
<?php
/**
 * Generate the navigation based on settings
 * @since 0.1
 */
add_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
function generate_add_navigation_after_header()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-below-header' == $generate_settings['nav_position_setting'] ) :
		generate_navigation_position();
	endif;
	
}
add_action( 'generate_before_header', 'generate_add_navigation_before_header', 5 );
function generate_add_navigation_before_header()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-above-header' == $generate_settings['nav_position_setting'] ) :
		generate_navigation_position();
	endif;
	
}
add_action( 'generate_before_header_content', 'generate_add_navigation_float_right', 5 );
function generate_add_navigation_float_right()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-float-right' == $generate_settings['nav_position_setting'] ) :
		generate_navigation_position();
	endif;
	
}
add_action( 'generate_before_right_sidebar_content', 'generate_add_navigation_before_right_sidebar', 5 );
function generate_add_navigation_before_right_sidebar()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-right-sidebar' == $generate_settings['nav_position_setting'] ) :
		echo '<div class="gen-sidebar-nav">';
			generate_navigation_position();
		echo '</div>';
	endif;
	
}
add_action( 'generate_before_left_sidebar_content', 'generate_add_navigation_before_left_sidebar', 5 );
function generate_add_navigation_before_left_sidebar()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-left-sidebar' == $generate_settings['nav_position_setting'] ) :
		echo '<div class="gen-sidebar-nav">';
			generate_navigation_position();
		echo '</div>';
	endif;
	
}

/**
 *
 * Build the navigation
 * @since 0.1
 *
 */
function generate_navigation_position()
{
	?>
	<nav itemtype="http://schema.org/SiteNavigationElement" itemscope="itemscope" id="site-navigation" role="navigation" <?php generate_navigation_class(); ?>>
		<div class="inside-navigation grid-container grid-parent">
			<?php do_action('generate_inside_navigation'); ?>
			<h3 class="menu-toggle"><span class="mobile-menu"><?php echo apply_filters('generate_mobile_menu_label', __( 'Menu', 'generate' ) ); ?></span></h3>
			<div class="screen-reader-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'generate' ); ?>"><?php _e( 'Skip to content', 'generate' ); ?></a></div>
			<?php 
			wp_nav_menu( 
				array( 
					'theme_location' => 'primary',
					'container' => 'div',
					'container_class' => 'main-nav',
					'menu_class' => '',
					'fallback_cb' => 'generate_menu_fallback',
					'items_wrap' => '<ul id="%1$s" class="%2$s ' . join( ' ', generate_get_menu_class() ) . '">%3$s</ul>'
				) 
			);
			?>
		</div><!-- .inside-navigation -->
	</nav><!-- #site-navigation -->
	<?php
}


/**
 * Menu fallback. 
 *
 * @param  array $args
 * @return string
 * @since 1.1.4
 */
function generate_menu_fallback( $args )
{ 
?>
	<div class="main-nav">
		<ul <?php generate_menu_class(); ?>>
			<?php wp_list_pages('sort_column=menu_order&title_li='); ?>
		</ul>
	</div><!-- .main-nav -->
<?php 
}

/**
 * If the navigation is in one of the sidebars, move it up top when on mobile
 * @since 1.1.0
 */
add_action('wp_footer','generate_mobile_navigation_position');
function generate_mobile_navigation_position()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-left-sidebar' !== $generate_settings['nav_position_setting'] && 'nav-right-sidebar' !== $generate_settings['nav_position_setting'] )
		return;
		
	?>
	<script type="text/javascript">
		jQuery(window).load(function($) {
			var mobile, widthTimer;
			mobile = jQuery( '.menu-toggle' );
			
			function generateCheckWidth() {
				if ( mobile.is( ':visible' ) ) {
					jQuery('.main-navigation').insertAfter('.site-header');
				} else {
					jQuery('.main-navigation').appendTo('.gen-sidebar-nav');
				}
			}
			
			if ( mobile.is( ':visible' ) ) {
				generateCheckWidth();
			}
			
			jQuery(window).resize(function() {
				clearTimeout(widthTimer);
				widthTimer = setTimeout(generateCheckWidth, 100);
			});
		});
	</script>
	<?php
}
 
WRInaute accro
C'est cette ligne qu'il faut changer :
Code:
<h3 class="menu-toggle"><span class="mobile-menu"><?php echo apply_filters('generate_mobile_menu_label', __( 'Menu', 'generate' ) ); ?></span></h3>
Remplace <h3> et </h3> par les balises que tu veux
 
WRInaute discret
-J'ai enlevé <h3></h3>,sans rien mettre à la place mais le menu ne s'affichait plus.
Je dois mettre quoi à la place ?


Sinon quel est le fichier que je dois modifier pour ne plus que "meta " et "archives " soient en h3 ?
Merci
 
Membre Honoré
Bonjour,

En retirant le H3, vous avez peut-être oublié l'utilisation de : class menu-toggle.

Cordialement.
 
WRInaute discret
Apres avoir enlevé <h3 </h3>, j'obtiens ce code .
Le menu ne s'affiche plus .
Ai je omis une balise ?
Code:
class="menu-toggle"><span class="mobile-menu"><?php echo apply_filters('generate_mobile_menu_label', __( 'Menu', 'generate' ) ); ?></span>
 
WRInaute accro
Code:
<div class="menu-toggle"><span class="mobile-menu"><?php echo apply_filters('generate_mobile_menu_label', __( 'Menu', 'generate' ) ); ?></span></div>
 
WRInaute discret
Merci zeb.
En ce qui concerne les balises h3 présentes sur meta et archives:
Quel fichier dois je modifier ?
<h3>meta</h3>
<h3>archives</h3>
 
WRInaute discret
J'ai remplacé <h3 </h3> par <div </div>
Dans le fichier navigation.php
Mais le menu ne s'affiche plus .
Les liens du menu ne s'affichent plus .
Voici le code
Code:
<?php
/**
 * Generate the navigation based on settings
 * @since 0.1
 */
add_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
function generate_add_navigation_after_header()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-below-header' == $generate_settings['nav_position_setting'] ) :
		generate_navigation_position();
	endif;
	
}
add_action( 'generate_before_header', 'generate_add_navigation_before_header', 5 );
function generate_add_navigation_before_header()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-above-header' == $generate_settings['nav_position_setting'] ) :
		generate_navigation_position();
	endif;
	
}
add_action( 'generate_before_header_content', 'generate_add_navigation_float_right', 5 );
function generate_add_navigation_float_right()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-float-right' == $generate_settings['nav_position_setting'] ) :
		generate_navigation_position();
	endif;
	
}
add_action( 'generate_before_right_sidebar_content', 'generate_add_navigation_before_right_sidebar', 5 );
function generate_add_navigation_before_right_sidebar()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-right-sidebar' == $generate_settings['nav_position_setting'] ) :
		echo '<div class="gen-sidebar-nav">';
			generate_navigation_position();
		echo '</div>';
	endif;
	
}
add_action( 'generate_before_left_sidebar_content', 'generate_add_navigation_before_left_sidebar', 5 );
function generate_add_navigation_before_left_sidebar()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-left-sidebar' == $generate_settings['nav_position_setting'] ) :
		echo '<div class="gen-sidebar-nav">';
			generate_navigation_position();
		echo '</div>';
	endif;
	
}

/**
 *
 * Build the navigation
 * @since 0.1
 *
 */
function generate_navigation_position()
{
	?>
	<nav itemtype="http://schema.org/SiteNavigationElement" itemscope="itemscope" id="site-navigation" role="navigation" <?php generate_navigation_class(); ?>>
		<div class="inside-navigation grid-container grid-parent">
			<?php do_action('generate_inside_navigation'); ?>
			<div class="menu-toggle"><span class="mobile-menu"><?php echo apply_filters('generate_mobile_menu_label', __( 'Menu', 'generate' ) ); ?></span>
</div>
			<div class="screen-reader-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'generate' ); ?>"><?php _e( 'Skip to content', 'generate' ); ?></a></div>
			<?php 
			wp_nav_menu( 
				array( 
					'theme_location' => 'primary',
					'container' => 'div',
					'container_class' => 'main-nav',
					'menu_class' => '',
					'fallback_cb' => 'generate_menu_fallback',
					'items_wrap' => '<ul id="%1$s" class="%2$s ' . join( ' ', generate_get_menu_class() ) . '">%3$s</ul>'
				) 
			);
			?>
		</div><!-- .inside-navigation -->
	</nav><!-- #site-navigation -->
	<?php
}


/**
 * Menu fallback. 
 *
 * @param  array $args
 * @return string
 * @since 1.1.4
 */
function generate_menu_fallback( $args )
{ 
?>
	<div class="main-nav">
		<ul <?php generate_menu_class(); ?>>
			<?php wp_list_pages('sort_column=menu_order&title_li='); ?>
		</ul>
	</div><!-- .main-nav -->
<?php 
}

/**
 * If the navigation is in one of the sidebars, move it up top when on mobile
 * @since 1.1.0
 */
add_action('wp_footer','generate_mobile_navigation_position');
function generate_mobile_navigation_position()
{
	$generate_settings = wp_parse_args( 
		get_option( 'generate_settings', array() ), 
		generate_get_defaults() 
	);
	
	if ( 'nav-left-sidebar' !== $generate_settings['nav_position_setting'] && 'nav-right-sidebar' !== $generate_settings['nav_position_setting'] )
		return;
		
	?>
	<script type="text/javascript">
		jQuery(window).load(function($) {
			var mobile, widthTimer;
			mobile = jQuery( '.menu-toggle' );
			
			function generateCheckWidth() {
				if ( mobile.is( ':visible' ) ) {
					jQuery('.main-navigation').insertAfter('.site-header');
				} else {
					jQuery('.main-navigation').appendTo('.gen-sidebar-nav');
				}
			}
			
			if ( mobile.is( ':visible' ) ) {
				generateCheckWidth();
			}
			
			jQuery(window).resize(function() {
				clearTimeout(widthTimer);
				widthTimer = setTimeout(generateCheckWidth, 100);
			});
		});
	</script>
	<?php
}
 
Discussions similaires
Haut