Recent posts in current category?

Here’s how I’d get the 20 (at most) most recent posts in the category.php page: <?php $max_posts = 20; $cat_ID = get_cat_ID ( single_cat_title( ”, false ) ); $args = array( ‘category’ => $cat_ID, ‘numberposts’ => $max_posts, ); $myposts = get_posts( $args ); foreach( $myposts as $post ) { setup_postdata( $post ); ?> <!– add … Read more

how to use a single checkbox with wpalchemy?

WP Alchemy comes with example files that show the usage of virtually all field types; Example; <?php $mb->the_field(‘cb_single’); ?> <input type=”checkbox” name=”<?php $mb->the_name(); ?>” value=”abc”<?php $mb->the_checkbox_state(‘abc’); ?>/> https://github.com/farinspace/wpalchemy/blob/master/wp-content/themes/mytheme/metaboxes/checkbox-meta.php#L9

WordPress Flyout Menus

also got UberMenu from code canyon that works perfect for the top menu, I can just use the conditional widgets on the right.

Meta boxes not showing on custom post type. Blank page?

To add a meta box to multiple post types, one add_meta_box per post type is needed. In this example, instead of duplicating the same code, a foreach is used. More post types can be added to the array and the meta box will be added in all of them: add_action( ‘add_meta_boxes’, ‘add_custom_box_wpse_94701’ ); function add_custom_box_wpse_94701() … Read more

username in rewritten URL, howto use it in a template

I created a new function, with which i get the username. Is there any problem with using it? Or is there a cleaner way of doing it? function getmyuser() { $test = substr($_SERVER[“REQUEST_URI”], strrpos($_SERVER[“REQUEST_URI”],”/user/”)+6); return str_replace(“https://wordpress.stackexchange.com/”,”, $test); }