Post titles and thumbnails as links to custom post types?

Something like this should solve your problem… <?php $pfportfolio = new WP_Query( array(‘post_type’=>’portfolio’, ‘posts_per_page’=>-1) ); ?> <?php if ( $pfportfolio->have_posts() ): ?> <ul class=”thumbnails”> <?php while ( $pfportfolio->have_posts() ) : $pfportfolio->the_post(); ?> <li class=”span4″ data-id=”post-<?php echo esc_attr(get_the_ID()); ?>” data-type=”<?php echo esc_attr(strip_tags( get_the_term_list( $post->ID, ‘location’, ”, ‘ ‘, ” ) ) ); ?>”> <a href=”https://wordpress.stackexchange.com/questions/108357/<?php the_permalink(); … Read more

Where to insert the other site image url for our wordpress post

Read about wp_insert_attachment(), wp_update_attachment_metadata() and wp_generate_attachment_metadata() To add an attachment, use wp_insert_attachment() example: <?php $wp_filetype = wp_check_filetype(basename($filename), null ); $wp_upload_dir = wp_upload_dir(); $attachment = array( ‘guid’ => $wp_upload_dir[‘url’] . “https://wordpress.stackexchange.com/” . basename( $filename ), ‘post_mime_type’ => $wp_filetype[‘type’], ‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, basename($filename)), ‘post_content’ => ”, ‘post_status’ => ‘inherit’ ); $attach_id = wp_insert_attachment( $attachment, $filename, 37 … Read more

Limiting post list by taxonomy

A simple search in codex shows how to do that : $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘people’, ‘field’ => ‘slug’, ‘terms’ => ‘bob’ ) ) ); $query = new WP_Query( $args ); EDIT: do not use showposts, it’s deprecated.

Loop not showing first post

It looks OK to me. There is nothing wrong with this part of your code. Maybe some earlier part is doing something strange with your $wp_query variable. You can try to add rewind_posts() before your loop – it should help. Just place rewind_posts(); just before if (have_posts())….

Change default post style to columns

There are multiple ways to that but what I like to do is to create shortcodes e.g [one_half] : function one_half_sh( $atts, $content = null ) { return ‘<div class=”one-half”>’ . do_shortcode($content) . ‘</div>’; } add_shortcode( ‘one_half’, ‘one_half_sh’ ); Then the CSS can look like this : .one-half { width: 48%; margin: 0 4% 0 … Read more

Get a term each custom post type

or printed “Array” That is your clue. Array indicates something is being returned, you just need to make use of it. Try var_dump($processing) and see what the array contains. In my plugins I have a functioned called example_var_dump(); and it is setup to use before the var_dump() line and after it. This displays arrays in … Read more

How come this loop is not working? [closed]

try this <div class=”container”> <div class=”inner_box”> <ul> <?php while ( have_posts() ) : the_post(); ?> <li> <?php the_title(); ?> <?php the_content(); //this is not in inner_box ?> </li> <?php endwhile; ?> </ul> </div> </div> try this <div class=”container”> <ul> <?php while ( have_posts() ) : the_post(); ?> <li> <div class=”inner_box”> <?php the_title(); ?> <?php the_content(); … Read more