Forum Replies Created
-
AuthorPosts
-
ilkweb
MemberBill Erickson has improved my code:
//* Customize 404 page entry title* *add_filter( 'genesis_404_entry_title', 'not_found_change_entry_title_text', 10, 2 );* *function not_found_change_entry_title_text( $text ) {* * $text = __( 'Sorry, nothing was found - English');* * return $text;* *}
It looks I was almost there.
ilkweb
MemberHello again, I've been experimenting and have come up with this snippet, and it seems to be working.
//* Customize 404 page entry title add_filter( 'genesis_404_entry_title', 'not_found_change_entry_title_text', 10, 2 ); function not_found_change_entry_title_text( $text ) { $text = __( 'Sorry, nothing was found'); return $text; }
Can you see any issues with it?
ilkweb
MemberHello Victor, I'm wanting to change the text that reads "Not found, error 404".
My specific site setup is a multisite. I will be using one child theme for both sites, and will be using plugins on both sites to change the aforementioned 404 text. The text will be different on each site (different languages).
ilkweb
MemberHi Anita,
Thanks for that, I'll take a look.
Meanwhile, I've found a function that works to replace 404 page meta titles:
//* Defines document title of 404 page function theme_slug_filter_wp_title( $title_parts ) { if ( is_404() ) { $title_parts['title'] = 'ADD 404 TITLE TEXT HERE'; } return $title_parts; } // Hook into document_title_parts add_filter( 'document_title_parts', 'theme_slug_filter_wp_title' );
I'll be adding this to a custom plugin.
My next task is to work out how to create a similar function to change 'Not found, error 404' using a plugin, as even with Bill's plugin, I was still getting the default text from 404.php on my page.
ilkweb
MemberHi Anita,
Thanks for the suggestion. I've already tried Bill's plugin but it does not change the meta titles of a 404 page. My site will be multi lingual and I want to the change document title from 'page not found' on the browser tab to a different language.
Other parts of the page show default text pulled from the Genesis 404.php file that Bill's plugin is not addressing.
I'm wanting to place the current 404.php text into a plugin the way you would with code that would normally go into functions.php. I just want to be able to make my customisations in the code directly. Bill's plugin is giving me a rich text editor which is not required.
The only other way I can think of for achieving what I have in mind is using a translation plugin, but it's really only a couple of things I want to change that are buried somewhere i nthe website code.
July 6, 2019 at 4:32 am in reply to: Use this Genesis function with conditional statements for multisite? #492159ilkweb
MemberMake sure you add the correct condition which i won't know until i see your live pages.
I've found a question similar to mine in which get_current_blog_id() is cited as the solution: https://wordpress.stackexchange.com/questions/283995/how-do-i-nest-conditionals-to-identify-sub-site-other-criteria
I've identified the blog urls as follows:
Blog ID = 1 (www.example.com/) using search box text 'Search'
Blog ID = 2 (www.example.com/en/) using search box text 'Search'
Blog ID = 3 (www.example.com/fr/) using search box text 'Chercher'July 6, 2019 at 3:59 am in reply to: Use this Genesis function with conditional statements for multisite? #492158ilkweb
MemberNo that won’t work for you , it’s only for parent/child pages that are correctly arranged in WordPress. For example you’d have a parent page called ‘About Us’ and child pages under that, is_tree will target the parent and all the pages under it , so it’s useful for things like custom sidebars for specific areas of the site that need to appear on all the children.
I wonder how functions.php will look at a multisite install though. Perhaps this could work? I'm using one functions.php file in a single child theme, and am running two websites with one WordPress multisite network.
July 6, 2019 at 3:45 am in reply to: Use this Genesis function with conditional statements for multisite? #492157ilkweb
MemberHi Brad,
Thanks for the suggestions! I'm developing in a local host, so I cannot provide links.
I'm aware of other conditions pertaining to multisite installs: https://codex.wordpress.org/Conditional_Tags#Part_of_a_Network_.28Multisite.29
July 5, 2019 at 1:47 pm in reply to: Use this Genesis function with conditional statements for multisite? #492146ilkweb
MemberThanks so much for the reply! The pages I am going to be targeting are actually the homepages of each website in the multisite installation. So /en/ and /fr/ are not actually WordPress pages.
Even so, would this work? http://www.example.com/en/ would be the top level domain, and therefore count as the homepage.
I doubt the following would work, so I'm eliminating it as a possibility:
if (is_tree(en)) { // 'en' is the parent page ID - change to your ID //* Customize search form input box text add_filter( 'genesis_search_text', 'sp_search_text' ); function sp_search_text( $text ) { return esc_attr( 'Search' ); } }
My other option is to use the plugin approach and place my function in each site. I'm still curious to know what my options are here so I'd be interested to carry on debating it!
Thanks again for the reply.
May 15, 2019 at 7:41 am in reply to: My Magazine Pro theme does not feature mobile hamburger menu #491173ilkweb
MemberI've solved this issue. I transplanted the code I identified in functions.php from the latest version of Magazine into my "old" version of function.php.
Also, I copied the mobile responsive CSS from the smartphone viewport and put that in my own stylesheet.
Works well.
May 12, 2019 at 4:48 am in reply to: My Magazine Pro theme does not feature mobile hamburger menu #491123ilkweb
MemberHi Anita,
Thanks for your response. I've been comparing my js files from 2015 compared to when the js files of Magazine were updated by StudioPress.
Here's a screenshot comparing them. I can see some are different and wonder if it's safe to simply copy across the new ones to the older folder.
I am running my site in WAMP as a localhost so there's no danger of messing anything up permanently.
Right-click the image below and choose "open image in new tab".
Also, I've compared the "new" and "old" functions.php and notices I'm missing code in my file pertaining to the js for mobile menus.
Here's what I believe I'm missing from my functions.php:
wp_enqueue_script( 'magazine-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menus' . $suffix . '.js', array( 'jquery' ), CHILD_THEME_VERSION, true ); wp_localize_script( 'magazine-responsive-menu', 'genesis_responsive_menu', magazine_responsive_menu_settings() ); } // Define our responsive menu settings. function magazine_responsive_menu_settings() { $settings = array( 'mainMenu' => __( 'Menu', 'magazine-pro' ), 'subMenu' => __( 'Submenu', 'magazine-pro' ), 'menuClasses' => array( 'combine' => array( '.nav-primary', '.nav-header', '.nav-secondary', ), ), ); return $settings; }
Here's an entire print out of my functions.php, including my customisations:
<?php //* Start the engine include_once( get_template_directory() . '/lib/init.php' ); //* Set Localization (do not remove) load_child_theme_textdomain( 'magazine', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'magazine' ) ); //* Child theme (do not remove) define( 'CHILD_THEME_NAME', __( 'Magazine Pro Theme', 'magazine' ) ); define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/magazine/' ); define( 'CHILD_THEME_VERSION', '3.0.1' ); // Enable PHP in widgets add_filter('widget_text','execute_php',100); function execute_php($html){ if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html); $html=ob_get_contents(); ob_end_clean(); } return $html; } /** * Add SVG capabilities */ function smallbizgeek_svg_mime_type( $mimes = array() ) { $mimes['svg'] = 'image/svg+xml'; $mimes['svgz'] = 'image/svg+xml'; return $mimes; } add_filter( 'upload_mimes', 'smallbizgeek_svg_mime_type' ); //* Add Shortcode function youtubeilk_function() { return '<div class="g-ytsubscribe" data-channel="ilkestonwebdesign" data-count="default" data-layout="full"></div>'; } add_shortcode('youtubeilk', 'youtubeilk_function'); //* Universally Parse Shortcodes add_filter('widget_text', 'do_shortcode'); //* Add HTML5 markup structure add_theme_support( 'html5' ); //* Run Smilies function through text widget sidebars add_filter( 'widget_text', 'convert_smilies' ); //* Add viewport meta tag for mobile browsers add_theme_support( 'genesis-responsive-viewport' ); //* Add new image sizes add_image_size( 'home-middle', 360, 200, true ); add_image_size( 'home-top', 750, 300, true ); add_image_size( 'sidebar-thumbnail', 100, 100, true ); /** Display related posts in Genesis based on Category */ function related_posts_categories() { if ( is_single ( ) ) { global $post; $count = 0; $postIDs = array( $post->ID ); $related = ''; $cats = wp_get_post_categories( $post->ID ); $catIDs = array( );{ foreach ( $cats as $cat ) { $catIDs[] = $cat; } $args = array( 'category__in' => $catIDs, 'post__not_in' => $postIDs, 'showposts' => 3, 'ignore_sticky_posts' => 1, 'orderby' => 'rand', 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-link', 'post-format-status', 'post-format-aside', 'post-format-quote' ), 'operator' => 'NOT IN' ) ) ); $cat_query = new WP_Query( $args ); if ( $cat_query->have_posts() ) { while ( $cat_query->have_posts() ) { $cat_query->the_post(); $related .= '<li><a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to' . get_the_title() . '">' . get_the_title() . '</a></li>'; } } } if ( $related ) { printf( '<div class="related-posts"><h3>Related Posts</h3><ul>%s</ul></div>', $related ); } wp_reset_query(); } } add_action( 'genesis_after_entry_content', 'related_posts_categories' ); //* Add support for additional color styles add_theme_support( 'genesis-style-selector', array( 'magazine-pro-blue' => __( 'Magazine Pro Blue', 'magazine' ), 'magazine-pro-green' => __( 'Magazine Pro Green', 'magazine' ), 'magazine-pro-orange' => __( 'Magazine Pro Orange', 'magazine' ), ) ); //* Add support for custom header add_theme_support( 'custom-header', array( 'default-text-color' => '000000', 'header-selector' => '.site-title a', 'header-text' => false, 'height' => 172, 'width' => 380, ) ); //* Reposition the primary navigation menu remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_before_header', 'genesis_do_nav' ); //* Add primary-nav class if primary navigation is used add_filter( 'body_class', 'backcountry_no_nav_class' ); function backcountry_no_nav_class( $classes ) { $menu_locations = get_theme_mod( 'nav_menu_locations' ); if ( ! empty( $menu_locations['primary'] ) ) { $classes[] = 'primary-nav'; } return $classes; } //* Customize search form input box text add_filter( 'genesis_search_text', 'magazine_search_text' ); function magazine_search_text( $text ) { return esc_attr( __( 'Search the site ...', 'magazine' ) ); } //* Customize search form input box text add_filter( 'genesis_search_text', 'sp_search_text' ); function sp_search_text( $text ) { return esc_attr( 'Search...' ); } //* Modify the size of the Gravatar in the author box add_filter( 'genesis_author_box_gravatar_size', 'magazine_author_box_gravatar' ); function magazine_author_box_gravatar( $size ) { return 140; } // Allow HTML in author bio section remove_filter('pre_user_description', 'wp_filter_kses'); //Add sanitization for WordPress posts add_filter( 'pre_user_description', 'wp_filter_post_kses'); //* Modify the size of the Gravatar in the entry comments add_filter( 'genesis_comment_list_args', 'magazine_comments_gravatar' ); function magazine_comments_gravatar( $args ) { $args['avatar_size'] = 100; return $args; } //* Remove entry meta in entry footer add_action( 'genesis_before_entry', 'magazine_remove_entry_meta' ); function magazine_remove_entry_meta() { //* Remove if not single post if ( ! is_single() ) { remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); } } //* Hooks after-entry widget area to single posts add_action( 'genesis_entry_footer', 'magazine_after_entry_widget' ); function magazine_after_entry_widget() { if ( ! is_singular( 'post' ) ) return; genesis_widget_area( 'after-entry', array( 'before' => '<div class="after-entry widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); } //* Remove comment form allowed tags add_filter( 'comment_form_defaults', 'magazine_remove_comment_form_allowed_tags' ); function magazine_remove_comment_form_allowed_tags( $defaults ) { $defaults['comment_notes_after'] = ''; return $defaults; } //* Add support for 3-column footer widgets add_theme_support( 'genesis-footer-widgets', 3 ); //* Register widget areas genesis_register_sidebar( array( 'id' => 'home-top', 'name' => __( 'Home - Top', 'magazine' ), 'description' => __( 'This is the top section of the homepage.', 'magazine' ), ) ); genesis_register_sidebar( array( 'id' => 'home-middle', 'name' => __( 'Home - Middle', 'magazine' ), 'description' => __( 'This is the middle section of the homepage.', 'magazine' ), ) ); genesis_register_sidebar( array( 'id' => 'home-bottom', 'name' => __( 'Home - Bottom', 'magazine' ), 'description' => __( 'This is the bottom section of the homepage.', 'magazine' ), ) ); genesis_register_sidebar( array( 'id' => 'after-entry', 'name' => __( 'After Entry', 'magazine' ), 'description' => __( 'This is the after entry section.', 'magazine' ), ) ); //Register WP Meet Up Header Right function cgp_extra_widgets() { genesis_register_sidebar( array( 'id' => 'wp-meet-up-header', 'name' => __( 'WP Meet Up Header Right', 'genesischild' ), 'description' => __( 'This is the WP Header Right', 'genesischild' ), ) ); } add_action( 'widgets_init', 'cgp_extra_widgets' ); function cgp_add_second_header_right() { if (is_page('4798') ) { remove_action( 'genesis_header', 'genesis_do_header' ); add_action( 'genesis_header', 'cgp_special_header' ); } function cgp_special_header() { //WP Meet Up Header Right genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div id="title-area">', 'context' => 'title-area', ) ); do_action( 'genesis_site_title' ); do_action( 'genesis_site_description' ); echo '</div>'; genesis_markup( array( 'html5' => '<aside %s>', 'xhtml' => '<div class="widget-area header-widget-area">', 'context' => 'header-widget-area', ) ); do_action( 'genesis_header_right' ); add_filter( 'wp_nav_menu_args', 'genesis_header_menu_args' ); add_filter( 'wp_nav_menu', 'genesis_header_menu_wrap' ); dynamic_sidebar( 'wp-meet-up-header' ); remove_filter( 'wp_nav_menu_args', 'genesis_header_menu_args' ); remove_filter( 'wp_nav_menu', 'genesis_header_menu_wrap' ); genesis_markup( array( 'html5' => '</aside>', 'xhtml' => '</div>', ) ); } } add_action('get_header', 'cgp_add_second_header_right'); /** Register Widget Area */ genesis_register_sidebar( array( 'id' => 'banners-1', 'name' => __( 'Email Subscribe Posts', 'mp' ), 'description' => __( 'Visible on single posts before comments', 'mp' ), ) ); genesis_register_sidebar( array( 'id' => 'banners-4', 'name' => __( 'HomePage Widget - Featured Stories', 'mp' ), 'description' => __( 'Only visible on front page.', 'mp' ), ) ); genesis_register_sidebar( array( 'id' => 'banners-2', 'name' => __( 'HomePage Widget', 'mp' ), 'description' => __( 'Only visible on front page.', 'mp' ), ) ); genesis_register_sidebar( array( 'id' => 'banners-3', 'name' => __( 'Email Subscribe Pages', 'mp' ), 'description' => __( 'Visible on single pages at bottom', 'mp' ), ) ); /** Add Widget Area */ add_action( 'genesis_before_comments', 'banner_widget_one' ); function banner_widget_one() { if ( is_single() ) { genesis_widget_area( 'banners-1', array( 'before' => '<div class="widget-area subscribe">', 'after' => '</div>', ) ); } } add_action( 'genesis_after_entry', 'banner_widget_four' ); function banner_widget_four() { if ( ( is_page(array('1109')) ) ) { genesis_widget_area( 'banners-4', array( 'before' => '<div class="widget-area homepage">', 'after' => '</div>', ) ); } } add_action( 'genesis_after_entry', 'banner_widget_two' ); function banner_widget_two() { if ( ( is_page(array('1109')) ) ) { genesis_widget_area( 'banners-2', array( 'before' => '<div class="widget-area homepage">', 'after' => '</div>', ) ); } } add_action( 'genesis_after_entry', 'banner_widget_three' ); function banner_widget_three() { if ( is_page() ) { genesis_widget_area( 'banners-3', array( 'before' => '<div class="widget-area subscribe">', 'after' => '</div>', ) ); } } //* Create a custom Gravatar add_filter( 'avatar_defaults', 'sp_custom_gravatar' ); function sp_custom_gravatar ($avatar) { $custom_avatar = get_stylesheet_directory_uri() . '/images/custom-gravatar.jpg'; $avatar[$custom_avatar] = "Custom Gravatar"; return $avatar; } //* Reposition the breadcrumbs remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); add_action( 'genesis_entry_header', 'genesis_do_breadcrumbs' ); //* Defines Clickable Logo and adds Blog Info to title function special_site_logo() {?><a id="sitelogo" href="<?php bloginfo( 'url' ); ?>"><img src="http://localhost/smallbizgeeklocal/wp-content/uploads/2014/images/logo.svg" width="145" alt="<?php bloginfo('name')?>" title="<?php bloginfo('name')?>" /></a><?php ; } add_action( 'genesis_site_title','special_site_logo',5,1); //* Defines Clickable Logo and adds Blog Info to title function wp_site_logo() { //* Show if WP meetup page if ( is_page('4798') ) { echo '<a id="sitelogo1" href=""><img src="http://localhost/smallbizgeeklocal/wp-content/uploads/2014/images/wp-logo.svg" style="margin:0 18px 0px 18px; height:134px;" width="100" height="170" alt="WordPress map pin" title="WordPress Meetup in Derby & Nottingham" /></a>';} } add_action( 'genesis_site_title','wp_site_logo',5,1); //* Add Social Buttons sharing shortcode function get_sharing() { return ' <div class="fbshare"> <div class="fb-share-button" data-type="button_count"></div> </div> <div class="googleplusshare"> <div class="g-plusone" data-annotation="bubble" data-width="120"></div> </div> <div class="linkedinshare"> <script type="IN/Share" data-counter="right"></script> </div> <div class="twittershare"> <a href="https://twitter.com/share" class="twitter-share-button" data-via="SmallBizGeekUK">Tweet</a> </div>'; } add_shortcode('sharing', 'get_sharing'); //* Add content seperator div shortcode function get_seperator() { return '<div class="border-line"> </div>'; } add_shortcode('seperator', 'get_seperator'); //* Modify the speak your mind title in comments add_filter( 'comment_form_defaults', 'sp_comment_form_defaults' ); function sp_comment_form_defaults( $defaults ) { $defaults['title_reply'] = __( 'Add Your Thoughts' ); return $defaults; } //* Modify the text before comments section add_filter( 'comment_form_defaults', 'cd_pre_comment_text' ); /** * Change the text output that appears before the comment form * Note: Logged in user will not see this text. * * @author Carrie Dils <http://www.carriedils.com> * @uses comment_notes_before <http://codex.wordpress.org/Function_Reference/comment_form> * */ function cd_pre_comment_text( $arg ) { $arg['comment_notes_before'] = "Your email address is safe and will NOT be shared with anyone else. <br><br>Hateful, spammy or abusive comments will not be tolerated. <br><br>For more information please see the <a href='http://www.smallbizgeek.co.uk/darren/comment-policy/' target='_blank' >comment policy</a>.<br><br>"; return $arg; }
I've submitted this thread to StudioPress support.
May 11, 2019 at 8:42 am in reply to: My Magazine Pro theme does not feature mobile hamburger menu #491109ilkweb
MemberHere's the link: https://www.smallbizgeek.co.uk/
May 11, 2019 at 8:15 am in reply to: My Magazine Pro theme does not feature mobile hamburger menu #491107ilkweb
MemberHi Anita,
I'm running Version: 3.0.1.
Here's a link to my stylesheet.
I tried adding the stylesheet from the most recent version of Magazine Pro (Version: 3.3.0) to my WAMP localhost copy of my site.
The layout aesthetics changed, but the mobile hamburger menu was not present in the narrow viewports.
I believe I'm missing some javascript, among other things.
May 3, 2016 at 9:07 am in reply to: How to use a custom field in a custom post type archive? (Explanation video) #184903ilkweb
MemberThanks Brad, that did it. I just wondered why you suggest using <span class> instead of <p class> here?
I used <div> and the <p> in my template and it is working well, inheriting the parent containers styles.
By the way, this is not the first time you have helped me, so thanks for your tips. I'm determined to learn as much by myself before I run crying to any support forums! Haha.
May 2, 2016 at 4:24 am in reply to: How to use a custom field in a custom post type archive? (Explanation video) #184788ilkweb
MemberHi Brad, thanks for responding.
I've been playing around with this and have created a function containing the fields. However, some of my posts have randomly disappeared from the archive.
I'm sure there's an error in my function. Here it is:
//* Add the event date after post title add_action( 'genesis_entry_header', 'colaw_display_date' ); function colaw_display_date() { if(have_posts()) : the_post(); /* The following code displays the Advanced Custom Fields meta boxes */ echo '<header class="entry-header"><p class="entry-meta">Event date: <time class="entry-time"> ' . get_field('date') . ' </time></p></header>'; echo '<div class="event-summary"> <b>Summary:</b> ' . get_field('summary') . ' </div>'; echo '<div class="event-cost"> <b>Cost:</b> ' . get_field('price') . ' </div>'; echo '<div class="event-duration"> <b>Duration:</b> ' . get_field('duration') . ' </div>'; endif; }
ilkweb
MemberThanks Victor
April 29, 2016 at 3:37 am in reply to: Executive Pro – Attribute Template Drop Down Missing from Custom Post Type #184667ilkweb
MemberFYI, I believe I'm on the way to solving this by myself, but if anyone can give any comments, please do and I'm sure it will reinforce my understanding.
April 28, 2016 at 4:50 pm in reply to: Backup WordPress site to localhost + publish regular changes to live site #184643ilkweb
MemberI use WAMP with WP Migrate DB. It's great for doing the find and replace on URLs without breaking serialised data. Instant WP is what I started with but I do not use it as much anymore.
I'm not so sure about syncing the changes automatically. DesktopServer might do that, but really, I find using WP Migrate DB is easy enough for pushing and pulling database changes.
If you change directory content, like style.css or any of the folders in /uploads/ it is easy enough for me to FTP into my remote server and copy the files to my WAMP directory.
ilkweb
MemberThanks for the tip Susan! So will the plugin that Davinder recommended put the widgets back into the right locations?
Thanks again.
ilkweb
MemberIs there no other way to prevent this problem? I'll check out the plugin though. Thanks for the response Davinder.
-
AuthorPosts