Timeline Page Layout Tutorials - CSS
http://mattbango.com/notebook/code/pure-css-timeline/ http://codepen.io/christian-fei/pen/BJily http://bashooka.com/coding/css-timeline-tutorials-examples/ http://codyhouse.co/demo/vertical-timeline/
http://mattbango.com/notebook/code/pure-css-timeline/ http://codepen.io/christian-fei/pen/BJily http://bashooka.com/coding/css-timeline-tutorials-examples/ http://codyhouse.co/demo/vertical-timeline/
Order your wordpress posts query by max or min meta key value by adding: orderby => ‘meta_value_num’ and the meta_key you wish to orderby.
1 |
$max_query = new WP_Query( array( 'post_type' => 'products', 'post_status' => 'publish', 'orderby'=>'meta_value_num', 'order'=>'DESC','meta_key'=>'wpcf-cost','posts_per_page'=>1) ); |
1 |
$min_query = new WP_Query( array( 'post_type' => 'products', 'post_status' => 'publish', 'orderby'=>'meta_value_num', 'order'=>'ASC','meta_key'=>'wpcf-cost','posts_per_page'=>1) ); |
On Page Template:
1 |
echo get_post_meta(get_the_ID(), '_yoast_wpseo_title', true); |
On Archive:
1 2 3 4 |
$titles = get_option( 'wpseo_titles' ); $title = $titles['title-ptarchive-POST_TYPE']; echo apply_filters( 'the_title', $title ); |
On Term SEO titles:
1 2 3 4 5 6 |
$cat_id = get_query_var( 'cat' ); $meta = get_option( 'wpseo_taxonomy_meta' ); $title = $meta['category'][$cat_id]['wpseo_title']; echo apply_filters( 'the_title', $title ); |
On Tags:
1 2 3 4 5 6 |
$tag_id = get_query_var( 'tag' ); $meta = get_option( 'wpseo_taxonomy_meta' ); $title = $meta['post_tag'][$tag_id]['wpseo_title']; echo apply_filters( 'the_title', $title ); |
Custom meta field values sometimes need tweaking. Need to convert current post meta in your database? Need to perform a str_replace or preg_replace on a specific custom meta key on your WordPress site? Here a quick function you can put … Continued
Completely disable the commenting system on your WordPress site.
1 |
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 |
// Disable support for comments and trackbacks in post types function df_disable_comments_post_types_support() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } } add_action('admin_init', 'df_disable_comments_post_types_support'); // Close comments on the front-end function df_disable_comments_status() { return false; } add_filter('comments_open', 'df_disable_comments_status', 20, 2); add_filter('pings_open', 'df_disable_comments_status', 20, 2); // Hide existing comments function df_disable_comments_hide_existing_comments($comments) { $comments = array(); return $comments; } add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2); // Remove comments page in menu function df_disable_comments_admin_menu() { remove_menu_page('edit-comments.php'); } add_action('admin_menu', 'df_disable_comments_admin_menu'); // Redirect any user trying to access comments page function df_disable_comments_admin_menu_redirect() { global $pagenow; if ($pagenow === 'edit-comments.php') { wp_redirect(admin_url()); exit; } } add_action('admin_init', 'df_disable_comments_admin_menu_redirect'); // Remove comments metabox from dashboard function df_disable_comments_dashboard() { remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); } add_action('admin_init', 'df_disable_comments_dashboard'); // Remove comments links from admin bar function df_disable_comments_admin_bar() { if (is_admin_bar_showing()) { remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60); } } add_action('init', 'df_disable_comments_admin_bar'); |
If you have any questions about how to disable comments in WordPress, you’re welcome to ask me on Disqus or get in touch with a WordPress developer … Continued
Vertically center bootstrap modals without setting a height. Modal max-height will not exceed the window height with scrollable .modal-body and adapts on resize. You will need these JS and CSS snippets:
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 |
function adjustModalMaxHeightAndPosition(){ $('.modal').each(function(){ if($(this).hasClass('in') === false){ $(this).show(); } var contentHeight = $(window).height() - 60; var headerHeight = $(this).find('.modal-header').outerHeight() || 2; var footerHeight = $(this).find('.modal-footer').outerHeight() || 2; $(this).find('.modal-dialog').addClass('modal-dialog-center').css({ 'margin-top': function () { var mH = $(this).outerHeight(); var wH = $(window).height(); return (mH < wH ) ? -( mH * 0.6): -( wH * 0.5) + 12; }, 'margin-left': function () { return -($(this).outerWidth() / 2); } }); if($(this).hasClass('in') === false){ $(this).hide(); } }); } if ($(window).height() >= 320){ $(window).resize(adjustModalMaxHeightAndPosition).trigger("resize"); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
.modal-dialog-center { margin: 0; margin-bottom: 12px; position: absolute; top: 50%; left: 50%; } .modal-footer { margin-top: 0; } @media (max-width: 767px) { .modal-dialog-center { width: 100%; } } |
View this on Codepen
Modify the number of WordPress posts or custom posts to be displayed on a custom archive page by adding this filter to your functions.php file in WordPress.
1 2 3 4 5 6 |
function mix_num_posts_for_archive($query) { if ($query->is_main_query() && $query->is_post_type_archive('your-custom-post-name') ) $query->set('posts_per_page', -1); } add_action('pre_get_posts', 'mix_num_posts_for_archive'); |
Change the number of “posts_per_page” to meet your specs, if you … Continued
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
function new_post_thumbnail_meta_box() { global $post; // we know what this does echo '<p>Content above the image.</p>'; $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); // grabing the thumbnail id of the post echo _wp_post_thumbnail_html( $thumbnail_id ); // echoing the html markup for the thumbnail echo '<p>Content below the image.</p>'; } function render_new_post_thumbnail_meta_box() { global $post_type; // lets call the post type // remove the old meta box remove_meta_box( 'postimagediv','post','side' ); // adding the new meta box. add_meta_box('postimagediv', __('Featured Image'), 'new_post_thumbnail_meta_box', $post_type, 'side', 'low'); } add_action('do_meta_boxes', 'render_new_post_thumbnail_meta_box'); |
Linkify your twitter hashtags and twitter user mentions! Need to replace twitter hashtags and usernames with the actual Twitter hashtag search query links/URLs and user profile pages? Twitter Username / User Mention Preg_replace
1 |
$tweetText = preg_replace("/@([a-zA-Z0-9_]+)/", '<a href="http://www.twitter.com/$1" target="_blank">@$1</a>', $tweetText); |
Twitter Hashtag Preg_replace
1 |
$tweetText = preg_replace('/(^|\s)#(\w*[a-zA-Z_]+\w*)/', '\1#<a href="http://twitter.com/search?q=%23\2">\2</a>', $tweetText); |
Is your success confirmation message not visible? Seeing this error: Unexpected token S? If you are using the Easy WP SMTP wordpress plugin, you may have an issue with your contact form 7 plugin. If the form is not loading … Continued