Repeating Loop on my Posts Page

In order not to interfere with main wp_query I would recommend to use this hook, that I used on one of my websites. //wp_query to buffer $temp_query = clone $wp_query; //Use main wp_query with attributes $wp_query = new WP_Query( array( ‘posts_per_page’ => 10 ) ); if(have_posts()) : while(have_posts()) : the_post(); //your code with html and … Read more

Problems with loop

the_post() function is what advances the internal counter and loads the data for the next post. You’re calling it between the title and content: the_title(); the_post(); the_content(); You want to change the order and move it before the output of any of the other template tags: the_post(); the_title(); the_content();

Filter Select results based on selection

Seeing as my comments seemed to answer the question: To get access to the URL params you want $wp_query->query_vars[‘myvar’]: http://wordpress.org/support/topic/how-to-pass-value-in-wordpress-url, e.g.: <?php global $wp_query; $node_id = 0; $args = array( ‘post_type’ => ‘jobs’, ‘category_name’ => $wp_query->query_vars[‘position_name’] ); $the_query = new WP_Query( $args ); The other parts of the question aren’t really WordPress issues, so Stack … Read more

Use wordpress functions in another PHP file

You must put your gallery.php in the same theme folder, where the theme’s functions.php resides. Then add a single line in functions.php: get_template_part(‘gallery’,”); It’ll include the gallery.php file into functions.php and gallery.php will behave like functions.php. So, you have to keep in mind that, functions.php file is a file for WordPress and PHP functions. So … Read more

How do i calculate the total of values of custom fields in custom post types?

It’s a matter of keeping a running total. Because I’m not 100% clear on the question, below I am providing the changes / pseudo-code for what you want to do: <?php if ( is_user_logged_in() ): global $current_user; get_currentuserinfo(); // ADDED: Initialize the total variable to prevent warnings $grandtotal = 0; $author_query = array(‘posts_per_page’ => ‘-1′,’author’ … Read more

how to define category loop last class in the third

You can do with php modulus % operator. Lets work with your code. <?php if ( have_posts() ) : ?> <?php twentyeleven_content_nav( ‘nav-above’ ); ?> <?php /* Start the Loop */ ?> <?php $count = 1; ?> <?php while ( have_posts() ) : the_post(); ?> <?php /* Include the Post-Format-specific template for the content. * … Read more

How to go about combining dropdowns / filter queries?

To get you started: you can make a custom form (I never worked with wp_dropdown_categories). When the form is submitted, it gets the input variables and uses them in the query. The form could be something like: <form action=”http://example.com/resultspage” method=”post”> <select name=”categories”> <option value=”categoryname1″></option> <option value=”categoryname2″></option> <option value=”categoryname3″></option> </select> <select name=”tags”> <option value=”tagname1″></option> <option value=”tagname2″></option> … Read more

How do I run through a WordPress loop called from a filter function?

When using a custom query, in order to access the $post information, you need to reference post as a class variable the custom WP_Query. Since you constructed the query as: $hw_selectbox_query = new WP_Query($hw_selectbox_args); Then you would access the post variable of $hw_selectbox_query, like so: var_dump($hw_selectbox_query->post); This will give you the information you need / … Read more