WordPress.org

Ready to get started?Download WordPress

Forums

Query Question (1 post)

  1. dwharrington
    Member
    Posted 1 year ago #

    I am using a theme called Yasmin and I want to use a custom query that I need help with. Obviously, I'm not a coder.

    Yasmin creates a special category of content called portfolio that it uses to display featured images and text in a certain way that I like.

    It also has a front page slider that draws images and text from posts. I would like to hack it so that the slider draws images and text from portfolio but am unsure how. I think a query could do it and someone who knows WordPress could tell me how:

    Here is how the theme queries portfolio pages:

    <?php 	$query = new WP_Query( array( 'post_type' => 'portfolio','posts_per_page' =>'3' ) );
    	           	if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();	?>

    Here is how the theme queries slider images:

    <?php 	$count = of_get_option('w2f_slide_number');
    				$slidecat = of_get_option('w2f_slide_categories');
    				$query = new WP_Query( array( 'cat' => $slidecat,'posts_per_page' =>$count ) );
    	           	if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();	?>
    
    		<li>
    				<?php $image_attr = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'top_feature'); ?>
    				<a href="<?php the_permalink() ?>">	<img src="<?php echo $image_attr[0]; ?>"></a>
    
    				<div class="flex-caption">
    					<h3> <?php the_title(); ?></h3>
    				</div>
    
    		</li>

Topic Closed

This topic has been closed to new replies.

About this Topic