After long gap another new tips is published today. Currently lot of users are using the Genesis Responsive Slider or Soliloquy Slider in Genesis Child Theme. But I am going with free version slider. Flexslider is a free slider which is coming from WooThemes. Minimum PRO Theme have no slider option for home page. So… Continue Reading
Archives for November 2014
Full Width Page Content with Blog Posts
Today one person asked this: However I really want the content full width. Would it be possible to adjust the template so that the primary sidebar only started as the blog posts started? This will be totally a custom page template. So creating a file “template_fwcblgpost.php” and add the following code. This new file will… Continue Reading
Controlling Footer Widget Columns from Theme Settings Page in Genesis
Previously I wrote a tutorial “How to change the footer copyright text from Genesis Theme Settings Page“. Today I am writing this article and showing you how to change the footer widget area from Genesis Theme Settings page. I added following PHP code in functions.php file: Creating Theme Settings for Footer Widget
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
function gd_defaults_settings_fields( $default_settings ) { $default_settings['footer_widgets'] = 3; // default is 3 return $default_settings; } add_filter( 'genesis_theme_settings_defaults', 'gd_defaults_settings_fields' ); function gd_genesis_settings_sanitization_filters() { genesis_add_option_filter( 'no_html', GENESIS_SETTINGS_FIELD, array( 'footer_widgets' ) ); } add_action( 'genesis_settings_sanitizer_init', 'gd_genesis_settings_sanitization_filters' ); add_action('genesis_theme_settings_metaboxes', 'gd_add_metaboxes', 99, 1); function gd_add_metaboxes( $pagehook ){ if( is_admin() ): add_meta_box( 'genesis-theme-settings-footer-widgets', __( 'Footer Widget Settings', 'genesis_developer' ), 'gd_footer_widgets_box', $pagehook, 'main', 'high' ); endif; } // Footer Widgets UI function gd_footer_widgets_box(){ ?> <p> <label for="<?php echo GENESIS_SETTINGS_FIELD;?>[footer_widgets]"><?php _e( 'Footer Widgets:', 'genesis' ); ?></label> <select name="<?php echo GENESIS_SETTINGS_FIELD;?>[footer_widgets]" id="<?php echo GENESIS_SETTINGS_FIELD;?>[footer_widgets]"> <?php for($i=0; $i <= 6; $i++){ ?> <option value="<?php echo $i; ?>"<?php selected( $i, genesis_get_option( 'footer_widgets' ) ); ?>><?php echo $i; ?></option> <?php } ?> </select> </p> <?php } |
Adding Footer… Continue Reading
Creating Footer Copyright Text UI in Theme Settings page of Genesis Framework
Today one question is came out from my mind. Why we can’t change the default footer copyright text from Genesis Theme Settings page? Every time we are installing the “Simple Edit” plugin or manually adding few code in the functions.php file. So I thoroughly checked the Genesis Theme Settings php file and got 2 filter… Continue Reading
How to change the "at" word next to the time in the post comments section?
ORIGINAL REQUEST: Hi, How can i change the “at” word next to the time in the post comments section? I want to translate it to “um”. Sample: 24. OKTOBER 2014 at 21:02 h I just reviewing the SP forums post and got this request. Immediately I checked the Genesis Comments Callback function and there have… Continue Reading
Page Content with Gird Blog Posts
This is a custom template. At top displaying the page content and below page content showing the latest blog posts in grid style. Create a file “template_custom.php” and add the following code. Now upload the file in your child theme folder.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
<?php /* Template Name: Static Content with Blog Posts */ // 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 = get_query_var( 'page' ); } $paged = intval( $paged ); if( $paged > 1 ){ remove_action('genesis_loop', 'genesis_do_loop'); } // Add your grid loop add_action( 'genesis_after_loop', 'gd_custom_grid_loop_helper' ); remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' ); add_action( 'genesis_after_endwhile', 'genesis_custom_tpl_posts_nav' ); /** Add support for Genesis Grid Loop **/ function gd_custom_grid_loop_helper() { global $paged; $first_page_limit = 4 $post_per_page = $next_page_limit = 10; if ( function_exists( 'genesis_custom_loop' ) ) { if( $paged == 1 ) $post_per_page = $first_page_limit; $args = array( 'post_type' => 'post', 'showposts' => $post_per_page, 'paged' => $paged); if( $paged > 1 ) $offset = ( $next_page_limit * ( $paged - 2 ) + $first_page_limit ); if( intval( $offset ) > 0 ) $args['offset'] = $offset; //* Add even/odd post class add_filter( 'post_class', 'gd_grid_post_class' ); genesis_custom_loop($args); }else { //* Add even/odd post class add_filter( 'post_class', 'gd_grid_post_class' ); genesis_standard_loop(); } remove_filter( 'post_class', 'gd_grid_post_class' ); } function gd_grid_post_class( $classes ) { global $wp_query; $classes[] = 'one-half'; $classes[] = ($wp_query->current_post % 2 == 0) ? 'first' : ''; return $classes; } function genesis_custom_tpl_posts_nav(){ if ( 'numeric' === genesis_get_option( 'posts_nav' ) ) genesis_custom_tpl_numeric_posts_nav(); else genesis_prev_next_posts_nav(); } function genesis_custom_tpl_numeric_posts_nav() { if( is_singular() ) return; global $wp_query, $paged; //* Stop execution if there's only 1 page if( $wp_query->max_num_pages <= 1 ) return; $max = intval( $wp_query->max_num_pages ); if( $paged == 1 ): $found_posts = $wp_query->found_posts - 4; $max = $wp_query->max_num_pages = intval( ceil( $found_posts / 10 ) ) + 1; endif; //* Add current page to the array if ( $paged >= 1 ) $links[] = $paged; //* Add the pages around the current page to the array if ( $paged >= 3 ) { $links[] = $paged - 1; $links[] = $paged - 2; } if ( ( $paged + 2 ) <= $max ) { $links[] = $paged + 2; $links[] = $paged + 1; } genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div class="navigation">', 'context' => 'archive-pagination', ) ); echo '<ul>'; //* Previous Post Link if ( get_previous_posts_link() ) printf( '<li class="pagination-previous">%s</li>' . "\n", get_previous_posts_link( apply_filters( 'genesis_prev_link_text', '«' . __( 'Previous Page', 'genesis' ) ) ) ); //* Link to first page, plus ellipses if necessary if ( ! in_array( 1, $links ) ) { $class = 1 == $paged ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' ); if ( ! in_array( 2, $links ) ) echo '<li class="pagination-omission">…</li>'; } //* Link to current page, plus 2 pages in either direction if necessary sort( $links ); foreach ( (array) $links as $link ) { $class = $paged == $link ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link ); } //* Link to last page, plus ellipses if necessary if ( ! in_array( $max, $links ) ) { if ( ! in_array( $max - 1, $links ) ) echo '<li class="pagination-omission">…</li>' . "\n"; $class = $paged == $max ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max ); } //* Next Post Link if ( get_next_posts_link() ) printf( '<li class="pagination-next">%s</li>' . "\n", get_next_posts_link( apply_filters( 'genesis_next_link_text', __( 'Next Page', 'genesis' ) . '»' ) ) ); echo '</ul></div>' . "\n"; } //* Run the Genesis loop genesis(); |
Create a page (Dashboard -> Pages -> Add New ) and select “Static… Continue Reading
Creating 5 Columns Footer Widgets
First open the functions.php file on Theme editor ( Dashboard->Appearance->Editor) or download the file via FTP/File Manager and open it on Notepad+ or any PHP editor. In maximum themes you will get this line add_theme_support( ‘genesis-footer-widgets’, 3 ); Change the value 3 to 5. If your theme is not supporting the footer widgets then add… Continue Reading
Column Classes Shortcode for Genesis Theme
Add the following codes in your functions.php file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
// Replace WP autop formatting if ( ! function_exists( 'gd_remove_wpautop' ) ) { function gd_remove_wpautop( $content ) { $content = do_shortcode( shortcode_unautop( $content ) ); $content = preg_replace( '#^<\/p>|^<br \/>|<p>$#', '', $content ); return $content; } // End gd_remove_wpautop() } /* ============= Two Columns ============= */ function gd_shortcode_one_half($atts, $content = null) { extract(shortcode_atts( array('first' => 'no'),$atts) ); if($first == "no"){ $class = "one-half"; } else { $class = "one-half first"; } return '<div class="' . $class . '">' . gd_remove_wpautop($content) . '</div>'; } add_shortcode( 'one_half', 'gd_shortcode_one_half' ); /* ============= Three Columns ============= */ function gd_shortcode_one_third($atts, $content = null) { extract(shortcode_atts( array('first' => 'no'),$atts) ); if($first == "no"){ $class = "one-third"; } else { $class = "one-third first"; } return '<div class="' . $class . '">' . gd_remove_wpautop($content) . '</div>'; } add_shortcode( 'one_third', 'gd_shortcode_one_third' ); function gd_shortcode_two_thirds($atts, $content = null) { extract(shortcode_atts( array('first' => 'no'),$atts) ); if($first == "no"){ $class = "two-thirds"; } else { $class = "two-thirds first"; } return '<div class="' . $class . '">' . gd_remove_wpautop($content) . '</div>'; } add_shortcode( 'two_thirds', 'gd_shortcode_two_thirds' ); /* ============= Four Columns ============= */ function gd_shortcode_one_fourth($atts, $content = null) { extract(shortcode_atts( array('first' => 'no'),$atts) ); if($first == "no"){ $class = "one-fourth"; } else { $class = "one-fourth first"; } return '<div class="' . $class . '">' . gd_remove_wpautop($content) . '</div>'; } add_shortcode( 'one_fourth', 'gd_shortcode_one_fourth' ); function gd_shortcode_two_fourths($atts, $content = null) { extract(shortcode_atts( array('first' => 'no'),$atts) ); if($first == "no"){ $class = "two-fourths"; } else { $class = "two-fourths first"; } return '<div class="' . $class . '">' . gd_remove_wpautop($content) . '</div>'; } add_shortcode( 'two_fourths', 'gd_shortcode_two_fourths' ); function gd_shortcode_three_fourths($atts, $content = null) { extract(shortcode_atts( array('first' => 'no'),$atts) ); if($first == "no"){ $class = "three-fourths"; } else { $class = "three-fourths first"; } return '<div class="' . $class . '">' . gd_remove_wpautop($content) . '</div>'; } add_shortcode( 'three_fourths', 'gd_shortcode_three_fourths' ); |
How to use these Shortcodes 1. One Half [one_half first=”yes|no”]ADD CONTENT HERE[/one_half] 2. One Third [one_third first=”yes|no”]ADD CONTENT HERE[/one_third] 3. Two Thirds [two_thirds first=”yes|no”]ADD CONTENT HERE[/two_thirds] 4. One Fourth [one_fourth first=”yes|no”]ADD CONTENT HERE[/one_fourth] 5. Two Fourth [two_fourths first=”yes|no”]ADD CONTENT HERE[/two_fourths] 6. Three Fourths [three_fourths first=”yes|no”]ADD CONTENT… Continue Reading
Add Subscribe Button at right side of the Logo
Adding the “Subscribe” button at right side of the logo and opening the MailChimp signup on lightbox popup. See the Setps First install the Easy Fancybox plugin and setup the plugin like this way: Next go to Widget page (Appearance -> widgets) and put the Text Widget in Header Right Widget Area. Add the following… Continue Reading
Dividing the Genesis Footer in 2 parts
I am dividing the Genesis Footer in 2 parts. I am filtering the “genesis_footer_output” function. I added the following the code in functions.php file
1 2 3 4 5 6 7 |
add_filter('genesis_footer_output', 'gd_footer_output', 10, 3); function gd_footer_output($output, $backtotop_text, $creds_text){ $new_output = '<div class="footer-left">' . $output . '</div>'; $new_output .= '<div class="footer-right">Website Design by <a href="https://genesisdeveloper.me" target="_blank">GENESISDEVELOPER.ME</div>'; return $new_output; } |
And added the following CSS in style.css file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
.footer-left{ float: left; width: 48.717% text-align: left; } .footer-right{ float: right; width: 48.717% text-align: right; } @media only screen and (max-width: 600px){ .footer-left, .footer-right{ clear: both; float: none; text-align: center; width: 100%; } } |
I am getting this output