How can I list posts with different formats depending on order?

WP_Query will track which post is current. For example: $p = new WP_Query(array(‘post_type’=>’post’,’posts_per_page’=> 10)); if ($p->have_posts()) { while ($p->have_posts()) { $p->the_post(); echo $p->current_post.'<br>’; } } You could use that to selectively format your posts. For example $p = new WP_Query(array(‘post_type’=>’post’,’posts_per_page’=> -1)); if ($p->have_posts()) { while ($p->have_posts()) { $p->the_post(); switch ($p->current_post) { case 0: case 3: … Read more

What are the default breakpoints set in WordPress?

The widths of the preview window in the Customiser when selecting the tablet and mobile device previews are 720px and 320px respectively. These are only defined in CSS, so there’s no hook or anything for specifically overwriting those sizes. The original styles are defined in /wp-admin/css/themes.css, and look like this: .preview-mobile .wp-full-overlay-main { margin: auto … Read more

Migrating to WordPress – but how will it do “structured” data?

Structured, as you named it, data in WordPress is combination of following features: [custom] post type – more accurately described as content type, you can register custom instead of bending generic “post” post type; taxonomies – for organizing posts into groups (native “category” and “tag” are taxonomies); custom fields – for storing bits of data … Read more

Function result goes outside div

You’re using a mix of echoing and returning. Here you’re starting by echoing: echo ‘<div class=”clear”></div>’; Here you’re putting the output into a variable (correctly): $output=”<div class=”row”>”; And here you’re just writing the content in quotes without echoing or assigning to a variable: ‘<div class=”col-md-8 grid-entry-wrapper”> <!– grid-entry-wrapper open –> <!– BLOG LOOP –> </div><!– … Read more

Wp admin – Set default value to 999 in comments

You can use add_filter(‘edit_comments_per_page’, ‘return_999’); function return_999(){ return 999; } since the user options are filtered in the WP_List_Table::get_items_per_page() class method : /** * Get number of items to display on a single page * * @since 3.1.0 * @access protected * * @return int */ function get_items_per_page( $option, $default = 20 ) { $per_page … Read more