Osclass Support Forums

Osclass theme support => Free themes => Topic started by: ishan on November 26, 2019, 06:45:15 AM

Title: How to display specific user listing on home page?
Post by: ishan on November 26, 2019, 06:45:15 AM
Please help me how to display particular user listings on home page?

i want to show user 5 all listings on home page so how to do ?
Title: Re: How to display specific user listing on home page?
Post by: MB Themes on November 26, 2019, 12:55:42 PM
@ishan
Check this:
https://docs.osclasspoint.com/display-only-certain-type-of-listings
Title: Re: How to display specific user listing on home page?
Post by: ishan on November 26, 2019, 03:01:05 PM
Hello i used your code for author but its not working


<?php osc_query_item("author=demo");
if( osc_count_custom_items() == 0) { ?>
    <p class="empty"><?php _e('No Listings', 'modern') ; ?></p>
<?php } else { ?>
    <table border="0" cellspacing="0">
         <tbody>
            <?php $class = "even"; ?>
            <?php while ( osc_has_custom_items() ) { ?>
             <tr class="<?php echo $class. (osc_item_is_premium()?" premium":"") ; ?>">
                    <?php if( osc_images_enabled_at_items() ) { ?>
                     <td class="photo">
                        <?php if( osc_count_item_resources() ) { ?>
                            <a href="<?php echo osc_item_url() ; ?>">
                                <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75" height="56" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />
                            </a>
                        <?php } else { ?>
                            <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
                        <?php } ?>
                     </td>
                    <?php } ?>
                     <td class="text">
                         <h3><a href="<?php echo osc_item_url() ; ?>"><?php echo osc_item_title() ; ?></a></h3>
                         <p><strong><?php if( osc_price_enabled_at_items() ) { echo osc_item_formated_price() ; ?> - <?php } echo osc_item_city(); ?> (<?php echo osc_item_region();?>) - <?php echo osc_format_date(osc_item_pub_date()); ?></strong></p>
                         <p><?php echo osc_highlight( strip_tags( osc_item_description() ) ) ; ?></p>
                     </td>                                       
                 </tr>
                <?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
            <?php } ?>
        </tbody>
    </table>
<?php }; ?>
Title: Re: How to display specific user listing on home page?
Post by: MB Themes on November 26, 2019, 06:12:12 PM
Code looks ok, just first line may need updates.
Title: Re: How to display specific user listing on home page?
Post by: ishan on November 27, 2019, 06:28:39 AM
Please tell me what link i need to update? which code will put therE?
Title: Re: How to display specific user listing on home page?
Post by: MB Themes on November 27, 2019, 03:12:40 PM
Test different parameters of osc_query_item function
Title: Re: How to display specific user listing on home page?
Post by: ishan on November 28, 2019, 07:11:22 AM
i tried all but those are not working for particular user.

i want to show only 1 user ads on home page
Title: Re: How to display specific user listing on home page?
Post by: MB Themes on November 30, 2019, 09:08:18 AM
Usually people do not try anything if they tried all combinations.

osc_query_item(array('author' => user_id / username));

If does not work (that usually do), you must create your own function.
Title: Re: How to display specific user listing on home page?
Post by: ishan on December 01, 2019, 07:30:12 AM
thanks its working with username... You are best


<?php osc_query_item(array('author' => "username"));
if( osc_count_custom_items() == 0) { ?>
    <p class="empty"><?php _e('No Listings', 'modern') ; ?></p>
<?php } else { ?>
    <table border="0" cellspacing="0">
         <tbody>
            <?php $class = "even"; ?>
            <?php while ( osc_has_custom_items() ) { ?>
             <tr class="<?php echo $class. (osc_item_is_premium()?" premium":"") ; ?>">
                    <?php if( osc_images_enabled_at_items() ) { ?>
                     <td class="photo">
                        <?php if( osc_count_item_resources() ) { ?>
                            <a href="<?php echo osc_item_url() ; ?>">
                                <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75" height="56" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />
                            </a>
                        <?php } else { ?>
                            <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
                        <?php } ?>
                     </td>
                    <?php } ?>
                     <td class="text">
                         <h3><a href="<?php echo osc_item_url() ; ?>"><?php echo osc_item_title() ; ?></a></h3>
                         <p><strong><?php if( osc_price_enabled_at_items() ) { echo osc_item_formated_price() ; ?> - <?php } echo osc_item_city(); ?> (<?php echo osc_item_region();?>) - <?php echo osc_format_date(osc_item_pub_date()); ?></strong></p>
                         <p><?php echo osc_highlight( strip_tags( osc_item_description() ) ) ; ?></p>
                     </td>                                       
                 </tr>
                <?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
            <?php } ?>
        </tbody>
    </table>
<?php }; ?>