Forum Replies Created
-
AuthorPosts
-
February 26, 2018 at 3:21 am in reply to: conditional when using genesis simple menu as secondary menu #217013Gary JonesMember
has_nav_menu( 'secondary' )
may be the bit you're missing here.Untested, but try:
add_action( 'genesis_entry_footer', 'bill_related_links' ); /** * Add "Related Links" title just above secondary menu in footer. */ function bill_related_links () { if ( is_singular( array ('page','mycpt') ) && has_nav_menu( 'secondary' ) ) { echo( '<strong>Related Searches:</strong>' ); } } // Reposition the secondary navigation menu to below content. remove_action( 'genesis_after_header', 'genesis_do_subnav' ); add_action( 'genesis_entry_footer', 'genesis_do_subnav' );
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberAngelo,
The existing schema attributes are added via the lib/functions/markup.php file.
You can use this solution to remove the microdata attributes.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberThere is no standard set of plugins - each site is different and require different things. People have their favourites which they install on each site _they_ do though.
In terms of SEO, there are a few (and most are better than Genesis SEO), but Yoast SEO tends to be the most popular.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
February 15, 2018 at 4:01 am in reply to: Genesis updated with modern CSS code? = Flexbox for column layouts for example? #216573Gary JonesMemberYour best bet is to try and get it into https://github.com/copyblogger/genesis-sample 😉
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberClick on your name / avatar top left, then Edit, and choose a different display name.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberThe advice is generally to have only one form of semantic data, so if you add JSON LD, then yes, I'd recommend you remove the microdata attributes as well.
See lib/functions/markup.php for where the microdata attributes are added in via a filter (so you can add your own filters to remove them, or remove_filter() when the filter *only* contains microdata attributes).
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberGary JonesMemberSee https://futuresonline.com/education/products/margin-requirements as an example.
Add the table as normal, but add
data-label
attributes totd
elements. Then, when viewing in a narrow screen, use CSS, to show these attributes as content on screen with::before
.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberThese are only warnings from PHPCS and they can be ignored here. PHP won't ever introduce native functions that start with
__genesis_
. Genesis works absolutely fine with PHP 7.0.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberGary JonesMemberI'd recommend WP Rocket, and if you're hosting on SiteGround, the SGCachePress plugin.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberToo much Plugins will kill the Pagespeed.
I'm afraid you're wrong. Too many badly coded plugins will affect performance.
Plugins which do lots of database complex reads and writes, or disk IO (reading and writing from the filesystem), or makes external requests (interacts with some 3rd party service) - they are the ones that cause a site to slow down.
A plugin which just holds the same snippet of code that you'd otherwise put into theme's functions.php, has no performance impact at all, compared to keeping that snippet in functions.php. Plugin which just register a post type, hook a function call in somewhere, add in some admin change or whatever, are all light - you could easily have (and I have my own site and client sites that do) 60-100 plugins of these very specific plugins, because having them as small modules make them easier to manage.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMember> But i don't like plugins. I preferred function and working dirrectly in the code.
There is nothing wrong with having code in a plugin. They aren't special in any way - it's just a different file to keep related logic in. Having code in plugins is usually far more advantageous then stuff it all into functions.php.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberYour CSS could include a selector that only targets the page template class that is added to the body element.
.page-template-default ... { ... }
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberThis wouldn't be a setting unless you have a plugin that handles this exact intent.
I'd suggest looking in the theme for where the menu is output (assuming not via a widget), and see if it checks for permissions there.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberI'd restructure it slightly differently:
<?php // Requires at least PHP 5.4 for the shorthand array syntax. // Define where our view files are. // The constant prefix should represent the theme. Here, I've pretended the theme is called 'jamesparkin'. define( 'JAMESPARKIN_VIEW_DIR', trailingslashit( get_stylesheet_directory() ) . 'views/' ); add_action( 'widgets_init', 'jamesparking_register_header_widgets' ); /** * Register custom widget areas. * * Note that this function name has a prefix, and an action - registering something. Functions should do something, * so try and name them with a verb. */ function jamesparking_register_header_widgets() { // Keep the data separate from what we do with the data for as long as possible. // This array could be extracted into its own function, or a config file, or filtered before using it etc. // Note that text domains should match with the theme slug - they should not be 'genesis'. $widget_areas = [ [ // Nicely align to = characters make it all much easier to read. // ID can be hyphenated to make it easier to read too. 'id' => 'jamesparkin-header-left', 'name' => __( 'CTA Widget Header Left', 'jamesparkin' ), // You could be more verbose with these descriptions. Give a clue as to what widgets can work well // in each of these widget areas, for instance. Just repeating the widget area title isn't helpful. 'description' => __( 'This is for the CTA Widget Left', 'jamesparkin' ), ], [ 'id' => 'jamesparkin-header-middle', 'name' => __( 'CTA Widget Header Middle', 'jamesparkin' ), 'description' => __( 'This is for the CTA Widget Middle', 'jamesparkin' ), ], [ 'id' => 'jamesparkin-header-right', 'name' => __( 'CTA Widget Header Right', 'jamesparkin' ), 'description' => __( 'This is for the CTA Widget Right', 'jamesparkin' ), ], ]; // Now loop through the data and use it to register sidebars. array_walk( $widget_areas, function( $widget_area ) { // Use genesis_register_widget_area() - does the same thing as genesis_register_sidebar(), but it helps to // think of these as widget areas which may not be displayed as a bar on the side of content. genesis_register_widget_area( $widget_area ); } ); } add_action( 'genesis_before_content', 'jamesparkin_display_header_widgets', 5 ); /** * Display call to action header widgets. */ function jamesparkin_display_header_widgets() { // Return early, makes code easier to follow. if ( ! is_home() ) { return; } // Don't have HTML stuffed into PHP strings. Have syntax-highlightable and front-end-developer-editable // HTML in simple files, and just include them where needed. include JAMESPARKIN_VIEW_DIR . 'header-widgets.php'; } ?>
<!-- wp-content/themes/jamesparkin/views/header-widgets.php --> <div class="header-widgets"> <div class="wrap"> <!-- Refer to output classes as -1, -2, -3, not left, middle, right as responsive design means they may not be shown in those positions. --> <div class="header-widget header-widget-1"> <?php echo genesis_widget_area( 'jamesparkin-header-left' ); ?> </div> <div class="header-widget header-widget-2"> <?php echo genesis_widget_area( 'jamesparkin-header-middle' ); ?> </div> <div class="header-widget header-widget-3"> <?php echo genesis_widget_area( 'jamesparkin-header-right' ); ?> </div> </div> </div> <!-- This final /div was missing from the code you posted. -->
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberHi Jose,
There's a filter right below the line you quoted, and you can use that to filter the crumb, so that the last two characters from the crumb are removed. Give the following a go - drop it at the end of your functions.php:
add_filter( 'genesis_day_crumb', function( $crumb ) { return substr( $crumb, 0, -2 ); } );
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
February 13, 2016 at 10:14 am in reply to: How Do I Include Image ALT Tags in Common Theme Images? #178965Gary JonesMemberImages in themes tend to be shown as background images, and therefore don't require alt attributes (not tags). They do not contribute to the content of the site, and therefore no alternative representation needs to be given.
For the example you've given, even if it is displayed inline (which would be less than ideal), the alt attribute should be an empty string (
alt=""
). It is purely for visual design, and again, has no bearing on the content and so no alternative text is needed. If you did give it, then screen readers would read out the redundant text and that would just distract from the actual content.The main thing to consider here, is that alt attributes re for human screen reader users. Any SEO benefit is most definitely a secondary factor, so trying to cater for SEO first will give poor results for your visitors.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMembergenesis/lib/structure/layout.php, around line 176, you should see:
$classes[] = esc_attr( sanitize_html_class( $new_class ) );
inside a function called
genesis_cpt_archive_body_class
. Can you please change that line to:$classes[] = esc_attr( $new_class );
And see if that fixes the problem?
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
Gary JonesMemberAt this moment in time, what you're seeing is intended behaviour. If you want to add multiple classes, you'll need to filter them in with code, not the UI.
However, I will make a suggestion to core developers that space-separation of multiple class is supported.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
-
AuthorPosts