Tag Info

Hot answers tagged

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

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


3

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


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

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

(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

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


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

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


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

i can't test this as a child theme of Genesis, but i just tested it on a child theme of Thematic and it worked fine. there isn't anything in the code that should prevent it from running. that said, i don't like registering post types as part of a theme... what if you change the theme down the line.... do you just want to lose (not lose since it will still ...


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

You can remove all the CSS code under the Media Queries section of any child theme built on Genesis. This code is generally located at the end of the style.css file. However, WordPress also includes responsiveness built in so its not really possible to totally remove everything unless you go to a lot of trouble. If you remove all the Media Queries, you ...


1

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


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


1

In your child themes functions file: add_action( 'pre_get_posts', 'wpsites_add_custom_post_types_to_loop' ); function wpsites_add_custom_post_types_to_loop( $query ) { if ( is_home() && $query->is_main_query() ) { $query->set( 'post_type', array( 'post', 'guides' ) ); return $query; } } This code will include your single CPT pages ...


1

I answered earlier but the link I provided doesn't exist anymore. So, I'll post the code here in hopes that it is what you're looking for. In your functions.php, add this snippet to create the markup: /* Mobile Menu ----------------------------------------------------------------------------------------*/ add_action( 'genesis_site_description', ...


1

Can't really help with custom Genesis code, but the WordPress way to modify the main loop is to filter pre_get_posts. To exclude Category ID 7 from contexts other than single post pages: function wpse72961_filter_pre_get_posts( $query ) { if ( is_main_query() && ! is_singular() ) { $query->set( 'category__not_in', 7 ); } ...


1

In every good theme, the </body> tag is located in the footer.php file. However, unless you're using a child theme, any modification will be lost on a theme update. That's why it's better to use the wp_footer filter hook like so: add_action( 'wp_footer', 'wpse_76330_aweber_tracking_code' ); function wpse_76330_aweber_tracking_code() { ?> ...


1

There is nothing 'improper' about the second block of code. Its just written for debugging purposes. The key difference is that that second block used get_the_ID(). Try that. add_action ('genesis_before_post_content', 'gteh_tagline'); function gteh_tagline() { $meta = get_post_meta(get_the_ID(), $field['dbt_text'], true); echo $meta; } Or try to ...


1

You need to set $post to global within a function: function wpse_16722_tagline() { global $post; $meta = get_post_meta( $post->ID, $field['dbt_text'], true ); echo $meta; } add_action ('genesis_before_post_content', 'wpse_16722_tagline');


1

Two problems with the first function: Use get_the_ID() or global the $post before using $post->ID. $field['dbt_text'] isn't defined in the function anywhere. Is this supposed to be coming from a global as well? Edit: After reading your comments and replies to the other answers, I think you don't understand how PHP's variable scoping works. You may want ...


1

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.



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