Hot answers tagged

5

Did you even open header.php and take a peek? You'll see genesis_before() called right after the opening <body> tag - follow the white rabbit and you get: function genesis_before() { do_action('genesis_before'); } And likewise for the footer. So... add_action( 'genesis_before', 'im_a_lazy_copy_paster' ); add_action( 'genesis_after', ...


5

On a category page, you can use the function single_cat_title(), or the more generic single_term_title(). These functions pull from the global $wp_query object, via get_queried_object().


5

And option 5 is to detect on client side what browser it is, and create a script element for your script directly into the dom, like google analytics an FB SDK do. This has the advantage of doing browser detection in the only place it should be done, the browser, and loading the IE specific scripts only when needed. In spirit it is very similar to your ...


5

Generally speaking, scripts and styles should never be directly printed to page. Reason is that another plugin or theme might add the same script again, and you get the same script added 2 or more times. If you enqueue asset the proper way, if other code enqueue the same asset again, it will be added once. For this reason you should skip options 3 and 4. ...


4

Today I had a similar issue and this worked for me: /** * Add and extra class to the entry-content div * */ function vdl_entry_content_extraclass( $attributes ) { $attributes['class'] = $attributes['class']. ' my-custom-class'; return $attributes; } add_filter( 'genesis_attr_entry-content', 'vdl_entry_content_extraclass' ); In my case, I am ...


4

You could try to use the wp_nav_menu_args filter (untested): /** * Add the Menu_With_Data_Attr walker to the wp_nav_menu() used by genesis_do_nav() */ add_filter( 'wp_nav_menu_args', function( $args ){ if( isset( $args['menu_class'] ) && 'menu genesis-nav-menu menu-primary' === $args['menu_class'] ) { if( ...


3

I've found explode() to be useful when trying to break strings apart. This code creates an array of paragraph chunks, inserts the new block after two paragraphs and concatenates it back into a string for output. function insert_ad_block( $text ) { if ( is_single() ) : $ads_text = '<div class="wpselect_middle_content">My Ad Code ...


3

To extend on @gmazzap suggestion on not using globals when you can use wp_scripts(), there is a shortcut for wp_scripts() for adding conditional comments called wp_script_add_data and likewise wp_style_add_data for conditional styles. So the correct way to use conditionals as of Wordpress 4.2 is like this: /** * IE enqueue HTML5shiv with conditionals * ...


3

So we have this: if ( is_home() ) { echo '<div id="featured-image-home"><img src="'. get_stylesheet_directory_uri() . '/images/sample.jpg" /></div>'; } elseif ( is_singular( array( 'post' ) ) ! has_post_thumbnail() ){ echo '<div id="featured-image-home"><img src="'. get_stylesheet_directory_uri() . ...


3

Please check this question. Its already contain 10+ answers about wordpress frameworks.


3

You can use a plugin such as this to show all of the Genesis hooks: http://wordpress.org/plugins/genesis-visual-hook-guide/. This will allow you to quickly find the right hook to modify to do this. Then modify the hook in the functions file. You can also use a plugin which allows you to easily modify hooks through the wp-admin: ...


2

Use the 'genesis_search_title_text' filter: add_filter( 'genesis_search_title_text', 'wpse_101947_search_title_text' ); function wpse_101947_search_title_text() { return 'Translated text'; } Replace Translated text with your translated text.


2

You edit the post page by using Genesis hooks (actions and / or filters). You can do this in the functions.php file or in a WordPress template file located in your child theme directory. If you use a template file, add the genesis() function call to the end of that file and you action and filters calls above it. For example, here is a single.php child ...


2

I finally did the old school way of disabling all plugins and enabling them one by one as suggested by the Studiopress Support team and found out that 'Genesis Simple Comments' plugin was causing this problem. Nick, the author of the plugin said that it needs an update, so for now the issue is solved.


2

You have found a bug in Genesis. Your Xdebug stack trace fingers the culprit as the genesis_save_custom_fields() function which calls current_user_can() with a singular capability (edit_post and edit_page) which also requires an additional argument, in this case the post ID which is missing. current_user_can() calls has_cap() which calls map_meta_cap() ...


2

(Cut/pasted from the OP.) SOLUTION: As it turns out, this is very simple. Go to your Dashboard --> Genesis --> Theme Settings Now in the box labelled "Content Archives" select "Display Post Excerpts" from the drop down menu. Now make sure the "Include the Featured Image" box is checked and select your image size. Save Settings. The featured-image ...


2

All you need is a simple query and to iterate over that query a couple of times so you can build the two required lists. WP_Query has a convenient method for resetting the pointer in the posts array, so you can loop over it again, called rewind_posts though i believe inside custom loops you have to reference the method directly.. Anyway, here's the kind of ...


2

Also using query_posts() is highly discouraged. If you need a second loop, use new WP_Query() or if you want to adjust the main loop then use pre_get_posts. If you home page is not a static page, then this should work regardless of what theme you use. (Goes in functions.php... preferably a child theme if you are working with a framework) function ...


2

get_the_terms() you are using is returning array of items, which cannot be simply echoed to page. You should try using higher level get_the_term_list() function, which returns string of concatenated results and can be echoed.


2

Just add the snippets in Genesis Theme function, in functions.php remove_action('genesis_after_header','genesis_do_nav'); add_action('genesis_before_header','genesis_do_nav');


2

Try this to create your custom titles. remove_filter( 'wp_title', 'genesis_default_title', 10, 3 ); //Default title remove_action( 'genesis_site_title', 'genesis_seo_site_title' ); //Genesis Extra Stuff remove_action( 'genesis_site_description', 'genesis_seo_site_description' ); //Genesis Extra Stuff add_filter( 'wp_title', 'genesis_default_title_new', 10, ...


2

The answer to which framework you should use is — no one knows. From code perspective there is certain degree of baseline theme functionality/experience — enforced by formal standards. Those things are recommended/required for inclusion into official theme directory, outside of that people can do things a little more lax. Frameworks exist for different ...


2

Try this: add_action( 'template_redirect', 'wpse_124609_remove_titles' ); /** * Move or remove some post titles. */ function wpse_124609_remove_titles() { if ( is_front_page() ) { remove_action( 'genesis_post_title', 'genesis_do_post_title' ); } else if ( is_page() || is_single() ) { remove_action( 'genesis_post_title', ...


2

I'm assuming you already know how to get your popup video working, and you want to know how to make sure only people who aren't logged in see the video. You can add this to your template file (footer.php is probably best): <?php if (is_front_page() && !is_user_logged_in()) { //video popup content } ?> WP: is_user_logged_in() » ...


2

This should do it. I can't test it right now. I used the genesis_header_markup_open() and the genesis_header_markup_open() Genesis functions and renamed them wpse_121660_header_markup_open() and wpse_121660_header_markup_close(). Then called them instead of the Genesis functions and added your new <div> in them. /** Reposition header outside main ...


2

Here is my solution for a Custom Post Type: Add this to functions.php. (Or, if you created a template for your custom post type like I did, such as single-instrument.php, add it to that instead of functions.php) // Display Advanced Custom Fields add_action('genesis_entry_header', 'type_of_instrument'); function type_of_attorney() { if ( ...


1

For anyone with the same problem, here's the answer. I finally figured it out. // Display Profile Sidebar ACF add_action('genesis_sidebar', 'employee_title'); function profile_photo() { if ( is_singular('profile') && genesis_get_custom_field('employee_title') ) echo '<div id="employee-title"> '. genesis_get_custom_field('employee_title') ...


1

EDIT Try this code: remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'sk_do_loop' ); function sk_do_loop(){ global $wp_query; $temp_query = $wp_query; // Fix for the WordPress 3.0 "paged" bug. $paged = 1; if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } if ( get_query_var( 'page' ) ) { $paged = ...


1

I'm not clear on how your code works as-is, as I mentioned in my comment. It looks like you're adding an action to call a function inside the function that you want to call with that action. If nothing outside the function invokes it, it never runs. add_action( 'template_redirect', 'check_breadcrumb_condition' ); function check_breadcrumb_condition(){ ...


1

You can use the genesis_post_info and genesis_post_meta filters in your child theme rather than modify the parent theme frameworks files which will be lost when you update Genesis. Remove comments link from post info add_filter( 'genesis_post_info', 'remove_post_info_comments_link' ); function remove_post_info_comments_link($post_info) { $post_info = ...



Only top voted, non community-wiki answers of a minimum length are eligible