search form closes after clicking in form field - php

Hi dear programming and PHP geniuses,
I'm new to php and effed up a search form on my Wordpress shop page (wich isn't public yet). After searching for the error for days I still have no clue where the error might be. I installed SublimeText + SublimeLinter to find a syntax error, but apparently there is none ...
The search form closes as soon as I try to type something in (as soon as I click in it).
I use the Mr. Tailor Theme: http://themeforest.net/item/mr-tailor-responsive-woocommerce-theme/full_screen_preview/7292110
So, here is the code (it's quite long and I'm not sure if this alone helps, so please let me know if I have to add anything):
<?php global $woocommerce, $mr_tailor_theme_options; ?>
<footer id="site-footer" role="contentinfo">
<div id="own_footer">
<img src="../../image_assets/logo_footer.png" alt="Logo">
<br><br><br>
<p>Folgen Sie uns auf: </p>
<img src="../../image_assets/instagram_footer.png" alt="Logo" >
<img src="../../image_assets/facebook_footer.png" alt="Logo" >
<img src="../../image_assets/pinterest_footer.png" alt="Logo" >
<br><br><br>
</div>
<br><br>
<p id="newsletter_copy">
NEWSLETTER
<br><br>
Sie haben Interesse an unserem Newsletter und möchten regelmäßig über neue Produkte,
Sonderangebote und andere tolle Sachen informiert werden? Dann registrieren Sie sich für unseren
Newsletter.
</p>
<div id="footer_eingabefeld">
<?php if ( is_active_sidebar( 'footer-widget-area' ) ) : ?>
<div class="trigger-footer-widget-area">
<span class="trigger-footer-widget-icon"></span>
</div>
<div class="site-footer-widget-area">
<div class="row">
<?php dynamic_sidebar( 'footer-widget-area' ); ?>
</div><!-- .row -->
</div><!-- .site-footer-widget-area -->
<?php endif; ?>
<div id="footer_links">
<li>Über Fuchs und Feder</li>
<li>Kontakt</li>
<li>FAQ</li>
<li>Impressum</li>
<li>Mein Konto</li>
</div>
<div class="site-footer-copyright-area">
<div class="row">
<div class="medium-4 columns">
<div class="payment_methods">
<?php
if ( (isset($mr_tailor_theme_options['credit_card_icons']['url'])) && (trim($mr_tailor_theme_options['credit_card_icons']['url']) != "" ) ) {
if (is_ssl()) {
$credit_card_icons = str_replace("http://", "https://", $mr_tailor_theme_options['credit_card_icons']['url']);
} else {
$credit_card_icons = $mr_tailor_theme_options['credit_card_icons']['url'];
}
?>
<img src="<?php echo $credit_card_icons; ?>" alt="<?php _e( 'Payment methods', 'mr_tailor' )?>" />
<?php } ?>
</div><!-- .payment_methods -->
</div><!-- .large-4 .columns -->
<div class="medium-8 columns">
<div class="copyright_text">
<?php if ( (isset($mr_tailor_theme_options['footer_copyright_text'])) && (trim($mr_tailor_theme_options['footer_copyright_text']) != "" ) ) { ?>
<?php _e( $mr_tailor_theme_options['footer_copyright_text'], 'mr_tailor' ); ?>
<?php } ?>
</div><!-- .copyright_text -->
</div><!-- .large-8 .columns -->
</div><!-- .row -->
</div><!-- .site-footer-copyright-area -->
</footer>
</div><!-- #page -->
</div><!-- /st-content -->
</div><!-- /st-pusher -->
<nav class="st-menu slide-from-left">
<div class="nano">
<div class="nano-content">
<div id="mobiles-menu-offcanvas" class="offcanvas-left-content">
<nav id="mobile-main-navigation" class="mobile-navigation" role="navigation">
<?php
wp_nav_menu(array(
'theme_location' => 'main-navigation',
'fallback_cb' => false,
'container' => false,
'items_wrap' => '<ul id="%1$s">%3$s</ul>',
));
?>
</nav>
<?php
$theme_locations = get_nav_menu_locations();
if (isset($theme_locations['top-bar-navigation'])) {
$menu_obj = get_term($theme_locations['top-bar-navigation'], 'nav_menu');
}
if ( (isset($menu_obj->count) && ($menu_obj->count > 0)) || (is_user_logged_in()) ) {
?>
<nav id="mobile-top-bar-navigation" class="mobile-navigation" role="navigation">
<?php
wp_nav_menu(array(
'theme_location' => 'top-bar-navigation',
'fallback_cb' => false,
'container' => false,
'items_wrap' => '<ul id="%1$s">%3$s</ul>',
));
?>
<?php if ( is_user_logged_in() ) { ?>
<ul><li><?php _e('Logout', 'mr_tailor'); ?></li></ul>
<?php } ?>
</nav>
<?php } ?>
<div class="language-and-currency-offcanvas hide-for-large-up">
<?php if (function_exists('icl_get_languages')) { ?>
<?php $additional_languages = icl_get_languages('skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str'); ?>
<select class="topbar-language-switcher">
<option><?php echo ICL_LANGUAGE_NAME; ?></option>
<?php
if (count($additional_languages) > 1) {
foreach($additional_languages as $additional_language){
if(!$additional_language['active']) $langs[] = '<option value="'.$additional_language['url'].'">'.$additional_language['native_name'].'</option>';
}
echo join(', ', $langs);
}
?>
</select>
<?php } ?>
<?php if (class_exists('woocommerce_wpml')) { ?>
<?php echo(do_shortcode('[currency_switcher]')); ?>
<?php } ?>
</div>
<div class="mobile-socials">
<div class="site-social-icons">
<ul class="//animated //flipY">
<?php if ( (isset($mr_tailor_theme_options['facebook_link'])) && (trim($mr_tailor_theme_options['facebook_link']) != "" ) ) { ?><li class="site-social-icons-facebook"><a target="_blank" href="<?php echo $mr_tailor_theme_options['facebook_link']; ?>"><i class="fa fa-facebook"></i><span>Facebook</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['twitter_link'])) && (trim($mr_tailor_theme_options['twitter_link']) != "" ) ) { ?><li class="site-social-icons-twitter"><a target="_blank" href="<?php echo $mr_tailor_theme_options['twitter_link']; ?>"><i class="fa fa-twitter"></i><span>Twitter</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['pinterest_link'])) && (trim($mr_tailor_theme_options['pinterest_link']) != "" ) ) { ?><li class="site-social-icons-pinterest"><a target="_blank" href="<?php echo $mr_tailor_theme_options['pinterest_link']; ?>"><i class="fa fa-pinterest"></i><span>Pinterest</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['linkedin_link'])) && (trim($mr_tailor_theme_options['linkedin_link']) != "" ) ) { ?><li class="site-social-icons-linkedin"><a target="_blank" href="<?php echo $mr_tailor_theme_options['linkedin_link']; ?>"><i class="fa fa-linkedin"></i><span>LinkedIn</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['googleplus_link'])) && (trim($mr_tailor_theme_options['googleplus_link']) != "" ) ) { ?><li class="site-social-icons-googleplus"><a target="_blank" href="<?php echo $mr_tailor_theme_options['googleplus_link']; ?>"><i class="fa fa-google-plus"></i><span>Google+</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['rss_link'])) && (trim($mr_tailor_theme_options['rss_link']) != "" ) ) { ?><li class="site-social-icons-rss"><a target="_blank" href="<?php echo $mr_tailor_theme_options['rss_link']; ?>"><i class="fa fa-rss"></i><span>RSS</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['tumblr_link'])) && (trim($mr_tailor_theme_options['tumblr_link']) != "" ) ) { ?><li class="site-social-icons-tumblr"><a target="_blank" href="<?php echo $mr_tailor_theme_options['tumblr_link']; ?>"><i class="fa fa-tumblr"></i><span>Tumblr</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['instagram_link'])) && (trim($mr_tailor_theme_options['instagram_link']) != "" ) ) { ?><li class="site-social-icons-instagram"><a target="_blank" href="<?php echo $mr_tailor_theme_options['instagram_link']; ?>"><i class="fa fa-instagram"></i><span>Instagram</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['youtube_link'])) && (trim($mr_tailor_theme_options['youtube_link']) != "" ) ) { ?><li class="site-social-icons-youtube"><a target="_blank" href="<?php echo $mr_tailor_theme_options['youtube_link']; ?>"><i class="fa fa-youtube-play"></i><span>Youtube</span></a></li><?php } ?>
<?php if ( (isset($mr_tailor_theme_options['vimeo_link'])) && (trim($mr_tailor_theme_options['vimeo_link']) != "" ) ) { ?><li class="site-social-icons-vimeo"><a target="_blank" href="<?php echo $mr_tailor_theme_options['vimeo_link']; ?>"><i class="fa fa-vimeo-square"></i><span>Vimeo</span></a></li><?php } ?>
</ul>
</div>
</div>
</div>
<div id="filters-offcanvas" class="offcanvas-left-content wpb_widgetised_column">
<?php if ( is_active_sidebar( 'catalog-widget-area' ) ) : ?>
<?php dynamic_sidebar( 'catalog-widget-area' ); ?>
<?php endif; ?>
</div>
</div>
</div>
</nav>
<nav class="st-menu slide-from-right">
<div class="nano">
<div class="nano-content">
<div id="minicart-offcanvas" class="offcanvas-right-content"><?php if ( class_exists( 'WC_Widget_Cart' ) ) { the_widget( 'mr_tailor_WC_Widget_Cart' ); } ?></div>
<div id="wishlist-offcanvas" class="offcanvas-right-content"><div class="widget"></div></div>
</div>
</div>
</nav>
</div><!-- /st-container -->
<!-- ******************************************************************** -->
<!-- * Custom Footer JavaScript Code ************************************ -->
<!-- ******************************************************************** -->
<?php if ( (isset($mr_tailor_theme_options['footer_js'])) && ($mr_tailor_theme_options['footer_js'] != "") ) : ?>
<script type="text/javascript">
<?php echo $mr_tailor_theme_options['footer_js']; ?>
</script>
<?php endif; ?>
<?php if ( (isset($mr_tailor_theme_options['sticky_header'])) && (trim($mr_tailor_theme_options['sticky_header']) == "1" ) ) : ?>
<!-- ******************************************************************** -->
<!-- * Sticky Header **************************************************** -->
<!-- ******************************************************************** -->
<div class="site-header-sticky">
<div class="row">
<div class="large-12 columns">
<div class="site-header-sticky-inner">
<div class="site-branding">
<?php
if ( (isset($mr_tailor_theme_options['site_logo']['url'])) && (trim($mr_tailor_theme_options['site_logo']['url']) != "" ) ) {
if (is_ssl()) {
$site_logo = str_replace("http://", "https://", $mr_tailor_theme_options['site_logo']['url']);
} else {
$site_logo = $mr_tailor_theme_options['site_logo']['url'];
}
?>
<img class="site-logo" src="<?php echo $site_logo; ?>" title="<?php bloginfo( 'description' ); ?>" alt="<?php bloginfo( 'name' ); ?>" />
<?php } else { ?>
<div class="site-title"><?php bloginfo( 'name' ); ?></div>
<?php } ?>
</div><!-- .site-branding -->
<?php
if ( (isset($mr_tailor_theme_options['site_logo_retina']['url'])) && (trim($mr_tailor_theme_options['site_logo_retina']['url']) != "" ) ) {
?>
<script>
//<![CDATA[
// Set pixelRatio to 1 if the browser doesn't offer it up.
var pixelRatio = !!window.devicePixelRatio ? window.devicePixelRatio : 1;
logo_image = new Image();
jQuery(window).load(function(){
if (pixelRatio > 1) {
jQuery('.site-logo').each(function() {
var logo_image_width = jQuery(this).width();
var logo_image_height = jQuery(this).height();
jQuery(this).css("width", logo_image_width);
jQuery(this).css("height", logo_image_height);
jQuery(this).attr('src', '<?php echo $mr_tailor_theme_options['site_logo_retina']['url'] ?>');
});
};
});
//]]>
</script>
<?php } ?>
<div id="site-menu">
<nav id="site-navigation" class="main-navigation" role="navigation">
<?php
wp_nav_menu(array(
'theme_location' => 'main-navigation',
'fallback_cb' => false,
'container' => false,
'items_wrap' => '<ul id="%1$s">%3$s</ul>',
));
?>
</nav><!-- #site-navigation -->
<div class="site-tools">
<ul>
<li class="mobile-menu-button"><a><i class="getbowtied-icon-menu"></i></a></li>
<?php if (class_exists('YITH_WCWL')) : ?>
<?php if ( (isset($mr_tailor_theme_options['main_header_wishlist'])) && (trim($mr_tailor_theme_options['main_header_wishlist']) == "1" ) ) : ?>
<li class="wishlist-button"><a><i class="getbowtied-icon-heart"></i></a><span class="wishlist_items_number"><?php echo yith_wcwl_count_products(); ?></span></li>
<?php endif; ?>
<?php endif; ?>
<?php if (class_exists('WooCommerce')) : ?>
<?php if ( (isset($mr_tailor_theme_options['main_header_shopping_bag'])) && (trim($mr_tailor_theme_options['main_header_shopping_bag']) == "1" ) ) : ?>
<?php if ( (isset($mr_tailor_theme_options['catalog_mode'])) && ($mr_tailor_theme_options['catalog_mode'] == 1) ) : ?>
<?php else : ?>
<li class="shopping-bag-button" class="right-off-canvas-toggle"><a><i class="getbowtied-icon-shop"></i></a><span class="shopping_bag_items_number"><?php echo $woocommerce->cart->cart_contents_count; ?></span></li>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ( (isset($mr_tailor_theme_options['main_header_search_bar'])) && (trim($mr_tailor_theme_options['main_header_search_bar']) == "1" ) ) : ?>
<li class="search-button"><a><i class="getbowtied-icon-search"></i></a></li>
<?php endif; ?>
</ul>
</div>
<div class="site-search">
<?php
if (class_exists('WooCommerce')) {
the_widget( 'WC_Widget_Product_Search', 'title=' );
} else {
the_widget( 'WP_Widget_Search', 'title=' );
}
?>
</div><!-- .site-search -->
</div><!-- #site-menu -->
<div class="clearfix"></div>
</div><!--.site-header-sticky-inner-->
</div><!-- .large-12-->
</div><!--.row-->
</div><!-- .site-header-sticky -->
<?php endif; ?>
<!-- ******************************************************************** -->
<!-- * WP Footer() ****************************************************** -->
<!-- ******************************************************************** -->
<div class="login_header">
<a class="go_home" href="<?php echo home_url(); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a>
</div>
<?php wp_footer(); ?>
</body>
</html>
Weird thing is also, that this code is from the footer.php, but still it apparently influences the search bar....
I know it's kinda like dynamite fishing, but I just ran out of ideas. So thank you all in advance!

You are referencing the event targets id but the event target does not have an id set. If you inspect your code, the search input element has no id set.
scripts.js(143):
$("body").on('click',function(e) {
if($(e.target).attr('class') == 'getbowtied-icon-search'
|| $(e.target).attr('id') == 's') {
return;
} else {
reset_search_toggles()
$('body').unbind('click');
}
});
If you can not add an id to that element for whatever reason you can also search by its name(I do not advise this, id's are much better).
if($(e.target).attr('class') == 'getbowtied-icon-search'
|| $(e.target).attr('id') == 's'
|| $(e.target).attr('name') == 's') {

Related

Wordpress The_content() returns null home

i have the content function at the end of this code that must show something under the posts and it shows in the single page (post details page)
but in the home just shows nothing at all
here is my code
<?php
/**
* The template for content.
*
* #package Webdoone
* #subpackage Ruby
* #since Ruby 1.1
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('wow fadeInUp'); ?>>
<?php if (has_post_format('gallery')) { ?>
<?php $images = get_post_meta($post->ID, '_format_gallery_images', true); ?>
<?php
if ($images) { ?>
<div class="post-img">
<div class="post-type-icon">
<i class="fa fa-picture-o"></i>
</div>
<div class="outter"><div class="inner">
<ul class="bxslider">
<?php
foreach ($images as $image) {
if ((get_theme_mod('ruby_webdoone_home_layout_settings') === 'home-ful' ) || (get_theme_mod('ruby_webdoone_archive_layout_settings') === 'arch-ful' ) || (get_theme_mod('ruby_webdoone_post_layout_settings') === 'post-ful' )) {
$the_image = wp_get_attachment_image_src($image, 'ruby_webdoone_custom_width');
$the_caption = get_post_field('post_excerpt', $image); ?>
<li><img src="<?php echo esc_url($the_image[0]); ?>"
<?php
if ($the_caption) {?>
title="<?php echo esc_attr($the_caption); ?>"<?php
}; ?> /></li><?php
} else {
$the_image = wp_get_attachment_image_src($image, 'ruby_webdoone_full_width');
$the_caption = get_post_field('post_excerpt', $image); ?>
<li><img src="<?php echo esc_url($the_image[0]); ?>"
<?php
if ($the_caption) { ?>
title="<?php echo esc_attr($the_caption); ?>"<?php
}; ?> /></li><?php
};
}; ?>
</ul>
</div></div>
</div><?php
}
} elseif (has_post_format('video')) { ?>
<div class="post-img video">
<div class="post-type-icon">
<i class="fa fa-video-camera"></i>
</div>
<div class="outter"><div class="inner">
<div class="fluid-width-video-wrapper" >
<?php $ruby_video = get_post_meta($post->ID, '_format_video_embed', true); ?>
<?php
echo $ruby_video;
?>
</div></div></div>
</div><?php
} elseif (has_post_format('audio')) { ?>
<div class="post-img audio">
<div class="post-type-icon">
<i class="fa fa-music"></i>
</div>
<?php $ruby_audio = get_post_meta($post->ID, '_format_audio_embed', true); ?>
<?php
if (wp_oembed_get($ruby_audio)) {
echo wp_oembed_get($ruby_audio);
} else {
echo esc_url($ruby_audio);
}; ?>
</div><?php
} else {
if (has_post_thumbnail()) { ?>
<div class="post-img">
<?php if (is_sticky()) { ?>
<div class="post-type-icon">
<i class="fa fa-thumb-tack"></i>
</div>
<?php } else { ?>
<div class="post-type-icon">
<i class="fa fa-pencil"></i>
</div>
<?php }
if (is_home()) {
if (!empty($_GET['layout'])) {
$layout = $_GET['layout'];
} else {
$layout = '';
};
if ((get_theme_mod('ruby_webdoone_home_layout_settings') === 'home-ful') || ($layout === 'home-ful')) { ?>
<div class="outter"><div class="inner">
<div class="grid home-full-thumb"><figure class="effect-jazz"><?php the_post_thumbnail('ruby_webdoone_full_width'); ?><figcaption></figcaption></figure></div> </div></div><?php
} else { ?>
<div class="outter"><div class="inner">
<div class="grid home-post-thumb"><figure class="effect-jazz"><?php the_post_thumbnail('ruby_webdoone_content_width'); ?><figcaption></figcaption></figure></div>
</div></div>
<?php
};
} elseif (is_single()) {
if (!empty($_GET['layout'])) {
$layout = $_GET['layout'];
} else {
$layout = '';
};
if ((get_theme_mod('ruby_webdoone_post_layout_settings') === 'post-ful') || ($layout === 'post-ful')) {
?>
<div class="outter"><div class="inner">
<?php the_post_thumbnail('ruby_webdoone_full_width'); ?>
</div></div>
<?php
} else {
?>
<div class="outter"><div class="inner">
<?php the_post_thumbnail('ruby_webdoone_content_width');?>
</div></div>
<?php
};
} else {
if (!empty($_GET['layout'])) {
$layout = $_GET['layout'];
} else {
$layout = '';
};
if ((get_theme_mod('ruby_webdoone_archive_layout_settings') === 'arch-ful') || ($layout === 'arch-ful')) { ?>
<div class="outter"><div class="inner">
<?php the_post_thumbnail('ruby_webdoone_full_width'); ?>
</div></div>
<?php
} else { ?>
<div class="outter"><div class="inner">
<?php the_post_thumbnail('ruby_webdoone_content_width'); ?>
</div></div>
<?php
};
};?>
</div><?php
};
}; ?>
<div class="post-header">
<?php
if (is_home()) { ?>
<h3><a class="pos-header-title-link" href="<?php esc_url(the_permalink()); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3><?php
} elseif (is_single()) { ?>
<h1 class="pos-header-title-link"><?php the_title(); ?></h1><?php
} else { ?>
<h2><a class="pos-header-title-link" href="<?php esc_url(the_permalink()); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2><?php
} ?>
<div class="post-info">
<span class="author"><?php esc_html_e('Author:', 'ruby') ?> <?php the_author_posts_link(); ?> \ </span>
<span class="date"><?php the_time(get_option('date_format')); ?> \ </span><span class="cat"><?php the_category(', '); ?></span>
<span class="comments-count">\ <?php printf( _nx( '1 Comment', '%1$s Comments', get_comments_number(), 'comments number', 'ruby' ), number_format_i18n( get_comments_number() ) ); ?></span>
</div>
</div>
<div class="post-data" itemprop="articleBody"><?php
the_content();
?> </div>
</article>
<?php wp_reset_postdata();
?>
how can i fix this ?
actually content must show this pictures section under posts and text or etc have no problem when i remove this func , wordpress wont show the like and other buttons under the posts .
please try this according to wp documentation
// Declare global $more (before the loop).
global $more;
// Set (inside the loop) to display all content, including text below more.
$more = 1;
the_content();
the_content does not work outside of "The Loop"
https://wordpress.stackexchange.com/a/44153/54343
edit: something akin to this is "the Loop"
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
the_content();
}
}
?>

add badge to thumbnail image

What I want to do on the front page where I have recent posts, is to add a small upper corner badge or ribbon that says "NEW" to the thumbnails of posts that were published on today's date. Below is my index.php which controls the front page layout:
<?php
/**
* The main template file.
*
* Used to display the homepage when home.php doesn't exist.
*/
?>
<?php
// Get options
$mts_options = get_option(MTS_THEME_NAME);
// Featured Section 1 settings ( slider is here) --------------------------------
$slider_enabled = ( $mts_options['mts_featured_slider'] === '1' ) ? true : false;
if ( empty($mts_options['mts_featured_slider_cat']) || !is_array($mts_options['mts_featured_slider_cat']) ) {
$mts_options['mts_featured_slider_cat'] = array('0');
}
$slider_cat = implode(",", $mts_options['mts_featured_slider_cat']);
// Featured Section settings --------------------------------------------------
$f2_title = $mts_options['mts_featured_section_2_title'];
if ( empty($mts_options['mts_featured_section_2_cat']) || !is_array($mts_options['mts_featured_section_2_cat']) ) {
$mts_options['mts_featured_section_2_cat'] = array('0');
}
$f2_cat= implode(",", $mts_options['mts_featured_section_2_cat']);
// Featured Section 3 settings --------------------------------------------------
get_header(); ?>
<div id="page">
<div class="article">
<?php if ( $slider_enabled && is_home() && !is_paged() ) { ?>
<section id="featured-section-1" class="featured-section featured-section-1-1 clearfix">
<div class="slider-container">
<div class="primary-slider-container clearfix loading">
<div id="slider" class="primary-slider">
<?php
$slider_full = 'best-featuredfull';
if ( empty( $mts_options['mts_custom_slider'] ) ) {
$my_query = new WP_Query('cat='.$slider_cat.'&posts_per_page='.$mts_options['mts_featured_slider_num']);
while ( $my_query->have_posts() ) : $my_query->the_post();
?>
<div>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail($slider_full,array('title' => '')); ?>
<div class="slider-caption">
<?php if(isset($mts_options['mts_home_headline_meta_info']['enabled']) && $mts_options['mts_home_headline_meta_info']['enabled']){ ?>
<div class="sliderdate">
<?php if(isset($mts_options['mts_home_headline_meta_info']['enabled']['date']) == '1') { ?>
<span class="thetime updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
<?php } ?>
</div>
<?php } ?>
<h2 class="slide-title"><?php the_title(); ?></h2>
</div>
<div class="post-day"><?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'review-total-only'); ?></div>
</a>
</div>
<?php endwhile; wp_reset_postdata();
} else { ?>
<?php foreach( $mts_options['mts_custom_slider'] as $slide ) : ?>
<div>
<a href="<?php echo esc_url( $slide['mts_custom_slider_link'] ); ?>">
<?php echo wp_get_attachment_image( $slide['mts_custom_slider_image'], $slider_full, false, array('title' => '') ); ?>
<div class="slider-caption">
<div class="sliderdate"><?php echo esc_html( $slide['mts_custom_slider_title'] ); ?></div>
<h2 class="slide-title"><?php echo esc_html( $slide['mts_custom_slider_text'] ); ?></h2>
</div>
</a>
</div>
<?php endforeach; ?>
<?php } ?>
</div>
</div>
</div><!-- slider-container -->
</section>
<?php } ?>
<?php if( $mts_options['mts_featured_section_2'] === '1' && is_home() && !is_paged() ) {// featured section 2 ?>
<section id="featured-section-3" class="featured-section clearfix">
<?php if (!empty($f2_title)) { ?><h4 class="featured-section-title"><?php echo $f2_title;?></h4><?php } ?>
<?php
$f2_query = new WP_Query('cat='.$f2_cat.'&posts_per_page=4');
$f2_count = 1; if ($f2_query->have_posts()) : while ($f2_query->have_posts()) : $f2_query->the_post();
$f2_loop_params = best_mixed_layout_params( 1, 2, $f2_count );// see functions.php
$f2_clear_class = $f2_loop_params['clear_class'];
$f2_type_class = $f2_loop_params['box_class'];
$f2_loop_thumb = $f2_loop_params['thumb'];
$f2_show_excerpt = $f2_loop_params['show_excerpt'];
$f2_show_author = $f2_loop_params['show_author'];
$begin_f2_extra_wrappers = $f2_loop_params['open_wrappers'];
$end_f2_extra_wrappers = $f2_loop_params['close_wrappers'];
?>
<article class="post-box latestPost mixed <?php echo $f2_type_class;?> <?php echo $f2_clear_class;?>">
<?php echo $begin_f2_extra_wrappers; ?>
<div class="post-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="nofollow">
<?php the_post_thumbnail($f2_loop_thumb,array('title' => '')); ?>
</a>
</div>
<div class="post-data">
<div class="post-data-container">
<header>
<h2 class="title post-title"><?php the_title(); ?></h2>
<?php mts_the_postinfo(); ?>
</header>
<?php if ($f2_show_excerpt) : ?>
<div class="post-excerpt">
<?php echo mts_excerpt(40); ?>
</div>
<?php endif; ?>
</div>
</div>
<?php echo $end_f2_extra_wrappers; ?>
</article><!--.post-box-->
<?php $f2_count++; endwhile;
endif; wp_reset_postdata();
?>
</section><!--#featured-section-3-->
<?php } ?>
<div id="content_box">
<?php $latest_posts_used = false;
if ( !empty( $mts_options['mts_featured_categories'] ) ) {
foreach ( $mts_options['mts_featured_categories'] as $section ) {
$category_id = $section['mts_featured_category'];
$featured_category_layout = $section['mts_featured_category_layout'];
$posts_num = $section['mts_featured_category_postsnum'];
if ( $category_id === 'latest' && ! $latest_posts_used ) {
$latest_posts_used = true;
$fc_section_class = ( in_array( $featured_category_layout, array( 'vertical', 'mixed' ) ) ) ? '' : ' '.$featured_category_layout;
?>
<section id="latest-posts" class="clearfix<?php echo $fc_section_class ?><?php //echo $fc_section_no_gap ?>">
<h4 class="featured-section-title"><?php _e( "Latest", "best" ); ?></h4>
<?php $j = 1; if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php best_the_homepage_article( $featured_category_layout, $j, true );?>
<?php $j++; endwhile; endif; ?>
<!--Start Pagination-->
<?php if (isset($mts_options['mts_pagenavigation_type']) && $mts_options['mts_pagenavigation_type'] == '1' ) { ?>
<?php $additional_loop = 0; mts_pagination($additional_loop['max_num_pages']); ?>
<?php } else { ?>
<div class="pagination pagination-previous-next">
<ul>
<li class="nav-previous"><?php next_posts_link( '<i class="fa fa-chevron-left"></i> '. __( 'Previous', 'best' ) ); ?></li>
<li class="nav-next"><?php previous_posts_link( __( 'Next', 'best' ).' <i class="fa fa-chevron-right"></i>' ); ?></li>
</ul>
</div>
<?php } ?>
<!--End Pagination-->
</section><!--#latest-posts-->
<?php } elseif ( $category_id !== 'latest' && !is_paged() ) {
$fc_section_class = ( in_array( $featured_category_layout, array( 'vertical', 'mixed' ) ) ) ? '' : ' '.$featured_category_layout;
?>
<section class="featured-section clearfix<?php echo $fc_section_class ?>">
<h4 class="featured-section-title"><?php echo get_cat_name($category_id); ?></h4>
<?php $cat_query = new WP_Query('cat='.$category_id.'&posts_per_page='.$posts_num); ?>
<?php $j = 1; if ($cat_query->have_posts()) : while ($cat_query->have_posts()) : $cat_query->the_post(); ?>
<?php best_the_homepage_article( $featured_category_layout, $j );?>
<?php $j++; endwhile; endif; wp_reset_postdata();?>
</section>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
What I have is this: to check the date and display the badge (not including css) but not sure where to input it exactly:
<?php
$days_old = (current_time(timestamp) - get_the_time('U') - (get_settings('gmt_offset') *3600 ) ) / (60*60*24);
if ($days_old <=1) {
echo <div class="post-badge">NEW</div>;
}
?>
I want to insert it into The Latest Post Section. Any help would be greatly appreciated:)

wordpress: show posts in two columns

I have a theme that shows the latest four posts in one column. I want to convert this to two posts in two columns.
I made two divs next to each other and put the first in descending order and the other in ascending order. Then I set it to show only 2 posts.
But now it shows 2 posts in the left div and all four posts in the right div:
I don't understand why it is doing this. Here is the code:
<section class="container">
<div class="left-half">
<article>
<!-- =========================
SECTION: LATEST NEWS
============================== -->
<?php
$parallax_number_of_posts = get_option('posts_per_page');
$args = array( 'post_type' => 'post', 'posts_per_page' => $parallax_number_of_posts, 'order' => 'ASC','ignore_sticky_posts' => true );
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
$parallax_one_latest_news_title = get_theme_mod('parallax_one_latest_news_title',esc_html__('Latest news','parallax-one'));
if($parallax_number_of_posts > 0) {
?>
<section class="brief timeline" id="latestnews" role="region" aria-label="<?php esc_html_e('Latest blog posts','parallax-one'); ?>">
<div class="section-overlay-layer">
<div align="center" class="container">
<div class="row">
<!-- TIMELINE HEADING / TEXT -->
<?php
if(!empty($parallax_one_latest_news_title)){
echo '<div class="col-md-12 timeline-text text-left"><h2 class="text-left dark-text">'.esc_attr($parallax_one_latest_news_title).'</h2><div class="colored-line-left"></div></div>';
} elseif ( isset( $wp_customize ) ) {
echo '<div class="col-md-12 timeline-text text-left paralax_one_only_customizer"><h2 class="text-left dark-text "></h2><div class="colored-line-left "></div></div>';
}
?>
<div class="parallax-slider-whole-wrap">
<!--<div class="controls-wrap">
<button class="control_next icon icon-arrow-carrot-down"><span class="screen-reader-text"><?php esc_attr_e('Post slider navigation: Down','parallax-one')?></span></button>
<button class="control_prev fade-btn icon icon-arrow-carrot-up"><span class="screen-reader-text"><?php esc_attr_e('Post slider navigation: Up','parallax-one')?></span></button>
</div>-->
<!-- TIMLEINE SCROLLER -->
<div itemscope itemtype="http://schema.org/Blog" id="parallax_slider" class="col-md-6 timeline-section">
<ul class="vertical-timeline" id="timeline-scroll">
<?php
$i_latest_posts= 0;
while ( $the_query->have_posts() ) : $the_query->the_post();
$i_latest_posts++;
if ( !wp_is_mobile() ){
if($i_latest_posts % 2 == 1){
echo '<li>';
}
} else {
echo '<li>';
}
?>
<div itemscope itemprop="blogPosts" itemtype="http://schema.org/BlogPosting" id="post-<?php the_ID(); ?>" class="timeline-box-wrap" title="<?php printf( esc_html__( 'Latest News: %s', 'parallax-one' ), get_the_title() ) ?>">
<div itemscope itemprop="image" class="icon-container white-text">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php
if ( has_post_thumbnail() ) :
the_post_thumbnail('parallax-one-post-thumbnail-latest-news');
else: ?>
<img src="<?php echo parallax_get_file('/images/no-thumbnail-latest-news.jpg'); ?>" width="150" height="150" alt="<?php the_title(); ?>">
<?php
endif;
?>
</a>
</div>
<div class="info">
<header class="entry-header">
<h1 itemprop="headline" class="entry-title"><br><br><br>
<?php the_title(); ?>
</h1>
<!-- .entry-meta -->
</header>
<div itemprop="description" class="entry-content entry-summary">
<?php the_excerpt(); ?>
<?php printf( esc_html__( 'Bekijk de fotos %s', 'textdomain' ), '<span class="screen-reader-text"> '.get_the_title().'</span>' ); ?>
</div>
</div>
</div>
<?php
if ( !wp_is_mobile() ){
if($i_latest_posts % 2 == 0){
echo '</li>';
}
} else {
echo '</li>';
}
endwhile;
wp_reset_postdata();
?>
</ul>
</div>
</div><!-- .parallax-slider-whole-wrap -->
</div>
</div>
</div>
</section>
<?php
}
} ?>
</article>
</div>
<!--rechts-->
<div class="right-half">
<article>
<!-- =========================
SECTION: LATEST NEWS
============================== -->
<?php
$parallax_number_of_posts = get_option('posts_per_page');
$args = array( 'post_type' => 'post', 'posts_per_page' => $parallax_number_of_posts, 'order' => 'DESC','ignore_sticky_posts' => true );
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
$parallax_one_latest_news_title = get_theme_mod('parallax_one_latest_news_title',esc_html__('Latest news','parallax-one'));
if($parallax_number_of_posts > 0) {
?>
<section class="brief timeline" id="latestnews" role="region" aria-label="<?php esc_html_e('Latest blog posts','parallax-one'); ?>">
<div class="section-overlay-layer">
<div align="center" class="container">
<div class="row">
<!-- TIMELINE HEADING / TEXT -->
<br>
<br>
<br>
<div class="parallax-slider-whole-wrap">
<div class="controls-wrap">
<button class="control_next icon icon-arrow-carrot-down"><span class="screen-reader-text"><?php esc_attr_e('Post slider navigation: Down','parallax-one')?></span></button>
<button class="control_prev fade-btn icon icon-arrow-carrot-up"><span class="screen-reader-text"><?php esc_attr_e('Post slider navigation: Up','parallax-one')?></span></button>
</div>
<!-- TIMLEINE SCROLLER -->
<div itemscope itemtype="http://schema.org/Blog" id="parallax_slider" class="col-md-6 timeline-section">
<ul class="vertical-timeline" id="timeline-scroll">
<?php
$i_latest_posts= 0;
while ( $the_query->have_posts() ) : $the_query->the_post();
$i_latest_posts++;
if ( !wp_is_mobile() ){
if($i_latest_posts % 2 == 1){
echo '<li>';
}
} else {
echo '<li>';
}
?>
<div itemscope itemprop="blogPosts" itemtype="http://schema.org/BlogPosting" id="post-<?php the_ID(); ?>" class="timeline-box-wrap" title="<?php printf( esc_html__( 'Latest News: %s', 'parallax-one' ), get_the_title() ) ?>">
<div itemscope itemprop="image" class="icon-container white-text">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php
if ( has_post_thumbnail() ) :
the_post_thumbnail('parallax-one-post-thumbnail-latest-news');
else: ?>
<img src="<?php echo parallax_get_file('/images/no-thumbnail-latest-news.jpg'); ?>" width="150" height="150" alt="<?php the_title(); ?>">
<?php
endif;
?>
</a>
</div>
<div class="info">
<header class="entry-header">
<h1 itemprop="headline" class="entry-title"><br><br><br>
<?php the_title(); ?>
</h1>
<!-- .entry-meta -->
</header>
<div itemprop="description" class="entry-content entry-summary">
<?php the_excerpt(); ?>
<?php printf( esc_html__( 'Bekijk de fotos %s', 'textdomain' ), '<span class="screen-reader-text"> '.get_the_title().'</span>' ); ?>
</div>
</div>
</div>
<?php
if ( !wp_is_mobile() ){
if($i_latest_posts % 2 == 0){
echo '</li>';
}
} else {
echo '</li>';
}
endwhile;
wp_reset_postdata();
?>
</ul>
</div>
</div><!-- .parallax-slider-whole-wrap -->
</div>
</div>
</div>
</section>
<?php
}
} ?>
</article>
</div>
</section>
If I understood correctly what you want to achieve - to divide several posts into two columns, I can not understand exactly how you want to achieve this into code. If you rely on this condition $the_query->current_post % 2 == 1 to filter the posts, then in your code it only filter printing of the li element, but then the cycle continues and show the post itself, ie what you achieve with this code is to place two posts (div.timeline-box-wrap) elements in one li.If you want to use this method of separation, you should change the code a little (I will simplify it, but the main is, that you must stop current loop if your condition pass).
You don't need to query DB two times with the same query - this is performance issue, so you can use the same result and loop over two times.
You can use $the_query->current_post to get current post and filter.
<section class="container">
<div class="left-half">
<article>
<?php
$parallax_number_of_posts = get_option('posts_per_page');
$args = array( 'post_type' => 'product', 'posts_per_page' => $parallax_number_of_posts, 'order' => 'ASC','ignore_sticky_posts' => true );
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
if($parallax_number_of_posts > 0) {
?>
<section class="brief timeline" id="latestnews" role="region" aria-label="<?php esc_html_e('Latest blog posts','parallax-one'); ?>">
<ul class="vertical-timeline" id="timeline-scroll">
<?php while ( $the_query->have_posts() ) : $the_query->the_post();
if($the_query->current_post % 2 == 1)
continue; ?>
<li><?php the_title() ?></li>
<?php endwhile; ?>
</ul>
</section>
<?php
}
} ?>
</article>
</div>
<div class="right-half">
<article>
<?php
$the_query->rewind_posts();
if ( $the_query->have_posts() ) {
if($parallax_number_of_posts > 0) {
?>
<section class="brief timeline" id="latestnews" role="region" aria-label="<?php esc_html_e('Latest blog posts','parallax-one'); ?>">
<ul class="vertical-timeline" id="timeline-scroll">
<?php while ( $the_query->have_posts() ) : $the_query->the_post();
if($the_query->current_post % 2 == 0)
continue; ?>
<li><?php the_title() ?></li>
<?php endwhile; ?>
</ul>
</section>
<?php
}
} ?>
</article>
</div>
</section>
P.S. You can simplify more, if you set 2 variables: $left and $right and use only one loop to set one or other with html, and then print their values.

How to properly implement a kerning generated code

I have a situation trying to implement into the <header>, a logotext using kerning technique, with this simple but very handy tool made by Mr.Andrew (special thanks).
Before the modification, I had this <header> section in header.php:
...
<!-- Start Header -->
<header class="header row no-padding <?php echo $header_style; ?>" data-equal=">.columns" role="banner">
<div class="small-7 medium-4 columns logo<?php if ($header_style == 'style1') { ?> show-for-large-up<?php } ?>">
<?php if ($header_style == 'style2') { ?>
<a class="logotext" href="<?php echo esc_url( home_url( '/' ) ); ?>"
title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"
rel="home"><?php bloginfo( 'name' ); ?>
</a>
<?php } ?>
</div>
<?php if ($header_style != 'style2') { ?>
<div class="small-7 medium-4 columns logo">
<?php if ($header_style == 'style1') { ?>
<a class="logotext" href="<?php echo esc_url( home_url( '/' ) ); ?>"
title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"
rel="home"><?php bloginfo( 'name' ); ?>
</a>
<?php } ?>
</div>
<?php } ?>
<div class="small-5 <?php if ($header_style == 'style2') { echo 'medium-8'; } else { echo 'medium-4';} ?> columns menu-holder">
<?php $full_menu_true = ($menu_mobile_toggle_view == 'style2' && $header_style == 'style2');?>
<?php if ($full_menu_true) { ?>
<nav id="full-menu" role="navigation">
<?php if ($page_menu) { ?>
<?php wp_nav_menu( array( 'menu' => $page_menu, 'depth' => 2, 'container' => false, 'menu_class' => 'full-menu', 'walker' => new thb_mobileDropdown ) ); ?>
<?php } else if(has_nav_menu('nav-menu')) { ?>
<?php wp_nav_menu( array( 'theme_location' => 'nav-menu', 'depth' => 2, 'container' => false, 'menu_class' => 'full-menu', 'walker' => new thb_mobileDropdown ) ); ?>
<?php } else { ?>
<ul class="full-menu">
<li>Please assign a menu from Appearance -> Menus</li>
</ul>
<?php } ?>
</nav>
<?php } ?>
<?php if ($header_search != 'off') { do_action( 'thb_quick_search' ); } ?>
<?php if ($header_cart != 'off') { do_action( 'thb_quick_cart' ); } ?>
<a href="#" data-target="open-menu" class="mobile-toggle<?php if (!$full_menu_true) { ?> always<?php } ?>">
<div>
<span></span><span></span><span></span>
</div>
</a>
</div>
</header>
<!-- End Header -->
...
using the generated kerning code, I was tried (and please correct me if it's a bad approach for php coding):
...
<!-- Start Header -->
<header class="header row no-padding <?php echo $header_style; ?>" data-equal=">.columns" role="banner">
<div class="row max_width ">
<div class="small-7 medium-4 columns logo<?php if ($header_style == 'style1') { ?> show-for-large-up<?php } ?>">
<?php if ($header_style == 'style2') { ?>
<span class="logotext" style="letter-spacing: -18px;">n</span>
<span class="logotext" style="letter-spacing: -17px;">e</span>
<span class="logotext" style="letter-spacing: -18.5px;">u</span>
<span class="logotext" style="letter-spacing: -13px;">e</span>
<span class="logotext" style="letter-spacing: -23.5px;">g</span>
<span class="logotext" style="letter-spacing: -7px;">r</span>
<span class="logotext" style="letter-spacing: -19px;">i</span>
<span class="logotext">d</span>
<?php } ?>
</div>
</div>
<?php if ($header_style != 'style2') { ?>
<div class="row max_width ">
<div class="small-7 medium-4 columns logo">
<?php if ($header_style == 'style1') { ?>
<span class="logotext" style="letter-spacing: -18px;">n</span>
<span class="logotext" style="letter-spacing: -17px;">e</span>
<span class="logotext" style="letter-spacing: -18.5px;">u</span>
<span class="logotext" style="letter-spacing: -13px;">e</span>
<span class="logotext" style="letter-spacing: -23.5px;">g</span>
<span class="logotext" style="letter-spacing: -7px;">r</span>
<span class="logotext" style="letter-spacing: -19px;">i</span>
<span class="logotext">d</span>
<?php } ?>
</div>
</div>
<?php } ?>
<div class="row max_width ">
<div class="small-5 <?php if ($header_style == 'style2') { echo 'medium-8'; } else { echo 'medium-4';} ?> columns menu-holder">
<?php $full_menu_true = ($menu_mobile_toggle_view == 'style2' && $header_style == 'style2');?>
<?php if ($full_menu_true) { ?>
<nav id="full-menu" role="navigation">
<?php if ($page_menu) { ?>
<?php wp_nav_menu( array( 'menu' => $page_menu, 'depth' => 2, 'container' => false, 'menu_class' => 'full-menu', 'walker' => new thb_mobileDropdown ) ); ?>
<?php } else if(has_nav_menu('nav-menu')) { ?>
<?php wp_nav_menu( array( 'theme_location' => 'nav-menu', 'depth' => 2, 'container' => false, 'menu_class' => 'full-menu', 'walker' => new thb_mobileDropdown ) ); ?>
<?php } else { ?>
<ul class="full-menu">
<li>Please assign a menu from Appearance -> Menus</li>
</ul>
<?php } ?>
</nav>
<?php } ?>
<?php if ($header_search != 'off') { do_action( 'thb_quick_search' ); } ?>
<?php if ($header_cart != 'off') { do_action( 'thb_quick_cart' ); } ?>
<a href="#" data-target="open-menu" class="mobile-toggle<?php if (!$full_menu_true) { ?> always<?php } ?>">
<div>
<span></span><span></span><span></span>
</div>
</a>
</div>
</div>
</header>
<!-- End Header -->
...
Now, not so sure why, the result looks as it should in Chrome but in IE11/Firefox the letters are scrambled somehow in vertical position.
Any thoughts?
LE: with all due respect, I have to reconsider the answer validation because the sugestion doesn't help to have a solution properly implemented, It looks ok in Chrome but in IE/Firefox the Kerning values (the main subject of this question) it doesn't have any effect.
Hope you don't mind guys, but I still need an answer to close this question having the right solution for me and other people that will deal with this issue in the future. If I didn't understand right the implementation steps, it will be ok to have an answer more specific with real examples, I'm not lazy, just a pure noob (I already mentioned in my posts).Thanks.
The issue is that your .logo div is constrained to 33% width because it also has the .medium-4 class.
IE and Firefox are actually handling this correctly. For whatever reason, chrome is letting the content exceed the specified width of the container; this has something to do with the display attribute for .logo being set to table.
The solution is to remove the medium-4 (and small-7) classes and either use the correct scaffolding classes or define the width in your CSS.

Change the order of returned posts

I have written a neat responsive slider for my Wordpress featured articles (feel free to use it):
<?php
$responsive = 'on' != get_option('henrik_responsive_layout') ? false : true;
$featured_auto_class = '';
if ( 'on' == get_option('henrik_slider_auto') ) $featured_auto_class .= ' et_slider_auto et_slider_speed_' . get_option('henrik_slider_autospeed');
?>
<div id="featured" class="<?php if ( $responsive ) echo 'flexslider' . $featured_auto_class; else echo 'et_cycle'; ?>">
<a id="left-arrow" href="#"><?php esc_html_e('Previous','henrik'); ?></a>
<a id="right-arrow" href="#"><?php esc_html_e('Next','henrik'); ?></a>
<?php if ( $responsive ) { ?>
<ul class="slides">
<?php } else { ?>
<div id="slides">
<?php } ?>
<?php global $ids;
$ids = array();
$arr = array();
$i=0;
$featured_cat = get_option('henrik_feat_cat');
$featured_num = (int) get_option('henrik_featured_num');
if (get_option('henrik_use_pages') == 'false') query_posts("showposts=$featured_num&cat=".get_cat_ID($featured_cat));
else {
global $pages_number;
if (get_option('henrik_feat_pages') <> '') $featured_num = count(get_option('henrik_feat_pages'));
else $featured_num = $pages_number;
query_posts(array
('post_type' => 'page',
'orderby' => 'menu_order',
'order' => 'ASC',
'post__in' => (array) get_option('henrik_feat_pages'),
'showposts' => (int) $featured_num
));
} ?>
<?php if (have_posts()) : while (have_posts()) : the_post();
global $post; ?>
<?php if ( $responsive ) { ?>
<li class="slide">
<?php } else { ?>
<div class="slide">
<?php } ?>
<?php
$width = $responsive ? 960 : 958;
$height = 340;
$small_width = 95;
$small_height = 54;
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$height,'',$titletext,$titletext,false,'Featured');
$arr[$i]['thumbnail'] = get_thumbnail($small_width,$small_height,'',$titletext,$titletext,false,'Small');
$arr[$i]['titletext'] = $titletext;
$thumb = $thumbnail["thumb"];
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, ''); ?>
<div class="featured-top-shadow"></div>
<div class="featured-bottom-shadow"></div>
<div class="featured-description">
<div class="feat_desc">
<p class="meta-info"><?php esc_html_e('Posted','henrik'); ?> <?php esc_html_e('by','henrik'); ?> <?php the_author_posts_link(); ?> <?php esc_html_e('on','henrik'); ?> <?php the_time(esc_attr(get_option('henrik_date_format'))) ?></p>
<h2 class="featured-title"><?php the_title(); ?></h2>
<p><?php truncate_post(410); ?></p>
</div>
<?php esc_html_e('Read More', 'henrik'); ?>
</div> <!-- end .description -->
<?php if ( $responsive ) { ?>
</li> <!-- end .slide -->
<?php } else { ?>
</div> <!-- end .slide -->
<?php } ?>
<?php $ids[] = $post->ID; $i++; endwhile; endif; wp_reset_query(); ?>
<?php if ( $responsive ) { ?>
</ul> <!-- end .slides -->
<?php } else { ?>
</div> <!-- end #slides -->
<?php } ?>
</div> <!-- end #featured -->
<div id="controllers" class="clearfix">
<ul>
<?php for ($i = 0; $i < $featured_num; $i++) { ?>
<li>
<div class="controller">
<a href="#"<?php if ( $i == 0 ) echo ' class="active"'; ?>>
<?php print_thumbnail( $arr[$i]['thumbnail']['thumb'], $arr[$i]['thumbnail']["use_timthumb"], $arr[$i]['titletext'], $small_width, $small_height ); ?>
<span class="overlay"></span>
</a>
</div>
</li>
<?php } ?>
</ul>
<div id="active_item"></div>
</div> <!-- end #controllers -->
It selects a custom category and returns a custom amount of posts. The problem is that it will display the posts in the order of which they were created. I want to choose my own order, so that I can select which posts displays first and so on.
So, is it possible to select which order the returned posts are displayed? Maybe by targeting specific IDs?
It looks like you're already doing this by using 'orderby' => 'menu_order'. All you need to do now is set the menu order in the WordPress interface -- all new posts default to 0. Or you change the orderby argument to something else.

Categories