Tag Info

Hot answers tagged

4

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', 'my_genesis_script' ); add_action( 'genesis_after', 'my_genesis_script' ...


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 ...


3

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().


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.


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

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

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

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

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 ...


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

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 ( ...


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

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( ...


1

According to Microsoft's docs, the syntax for revealing and hiding content using conditional comments are different, so since you're trying to only use (reveal) the script for IE8 and below (vs. hiding it), the echo statement should change to: echo '<![if lt IE 9]><script ...


1

If you replace genesis_get_additional_image_sizes(); with genesis_get_image_sizes() you can choose any size image for the widget thumbnail. Replacement featured-post-widget.php is available on GitHub. And here is the replacement code: $sizes = genesis_get_image_sizes(); foreach( (array) $sizes as $name => $size ) ...


1

How about instead of genesis_custom_field('instrument'); use: echo genesis_get_custom_field('instrument'); Plus the genesis_after_post_title action hook is deprecated since 1.7.0 and you should use genesis_entry_header with correct priorities. For more information please use the reference links below. Reference: genesis_after_post_title Genesis 2.0 ...


1

I think both issues can be solved by altering what's happening inside the loop. The code you've posted are the arguments that are used for the query. There is a while loop which then goes through the results of the query and displays them. Try to find while ($wp_query->have_posts()): $wp_query->the_post();. Between this and endwhile; the results are ...


1

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', ...


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

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, ...


1

This: $thm_out[array_rand($thm_out, 2)] is the same as $them_out[array(0,2)] where 0 and 2 are 2 random keys. See array_rand I hope you can see what is wrong there. Change that to: $thm_out[array_rand($thm_out, 1)] which is the same as $them_out[2] where 2 is any random key.



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