Osclass Support Forums
Osclass theme support => CareerJob Osclass Jobs Theme => Topic started by: developGr on November 20, 2020, 09:23:01 AM
-
I want to use the image of the item.php to be show in the search.php instead of the profile picture of company that its set at the user-profile.php
-
@developGr
In loop-single.php (-premium.php) search for:
<img src="<?php echo careerjob_profile_picture(osc_item_user_id(), 'small'); ?>" alt="<?php echo osc_esc_html((osc_item_user_id() > 0 ? $user['s_name'] : osc_item_contact_name())); ?>"/>
Replace it with:
<img src="<?php echo osc_resource_thumbnail_url(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?>"/>
You may check sigma/bender theme for more clarity on functions to be used.
-
when i make those steps i am getting that:
-
and
-
@developGr
Checkout docs.
https://docs.osclasspoint.com/hitems-php
https://docs.osclasspoint.com/hpremium-php
osc_resource_thumbnail_url() is proper function to get listing pictures.
-
so what is the problem?
-
@developerGr
You will have to be able to investigate by yourself how to fix problems caused by your modifications.
Try to put following functions before img tag:
<?php osc_count_item_resources(); ?>
it may reload resources.
-
ok now the images are showing just fine the only prob its that for the users that has not any images yet the code that its loading for each one in the results its that:
<img src="https://domain.com/NEW/0_thumbnail."
how can i load the...oc-content/themes/careerjob/images/profile-64.png if the user has not yet uploaded any image at the listing?
what code i have now in "loop-single.php"
<div class="front">
<?php osc_count_item_resources(); ?>
<img src="<?php echo osc_resource_thumbnail_url(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?>"/>
</div>
-
@developGr
Basically you change this:
<?php echo osc_resource_thumbnail_url(); ?>
into:
<?php echo (osc_count_item_resources() > 0 ? osc_resource_thumbnail_url() : osc_base_url() . 'oc-content/themes/careerjob/images/profile-64.png'); ?>
-
Now it works!!