Home Support General HivePress Multiple ‘description’ fields on a listing?

Multiple ‘description’ fields on a listing?

  • Author
    Posts
  • josh.babarinde

    Is it possible to create multiple ‘description’ fields on a listing?

    I’m looking to create a structure for uploading recipes and have separate fields for ‘step 1’, ‘step 2’, ‘step 3’ etc. on each listing.

    Thanks!

    gabetu

    Yes it’s possible:

    1. Create your attributes called “Step 1”, “Step 2”, etc., field type “Textarea” and note that the slugs are “step_1”, “step_2”, etc. – https://ibb.co/vmwkQVS
    2. You need a child theme for ListingHive or other theme you are using.
    3. Create a structure like this:
    themes/child-theme/hivepress/listing/view/page/listing-description.php
    4. Use the following code in listing-description.php

    <?php
    // Exit if accessed directly.
    defined( 'ABSPATH' ) || exit; ?>
    
    <?php if ( $listing->get_description() ) : ?>
    	<div class="hp-listing__description"><?php echo $listing->display_description(); ?></div>
    <?php endif; ?>
    
    <?php if ( $listing->display_step_1() ) : ?>
        <h3>Step 1</h3>
        <div class="hp-listing__description"><?php echo $listing->display_step_1(); ?></div>
    <?php endif; ?>
    
    <?php if ( $listing->display_step_2() ) : ?>
        <h3>Step 2</h3>
        <div class="hp-listing__description"><?php echo $listing->display_step_2(); ?></div>
    <?php endif; ?>

    See a live example

    ihor developer

    Thanks @gabetu

    josh.babarinde

    Thank you so much, @gabetu!

    I’m new to this so can definitely do step 1 but I’m stuck from step 2 – so sorry! How would I create a ‘child theme’ and the structure mentioned in step 3?

    If there’s a video you could point me to, that would be fantastic.

    Apologies again for my code inexperience – still learning!

    gabetu

    No problem, you can use a plugin for creating a child theme: https://wordpress.org/plugins/child-theme-generator/

    Then you will need to access the cpanel and under child-theme folder create other folders structure:
    – hivepress
    — listing
    — view
    —- page

    And under the last folder “page” create the file “listing-description.php” and use the code suggested above.

    Also, you can change the order of the blocks, moving the description below the “steps”:

    <?php
    // Exit if accessed directly.
    defined( 'ABSPATH' ) || exit; ?>
    
    <?php if ( $listing->display_step_1() ) : ?>
        <h3>Step 1</h3>
        <div class="hp-listing__description"><?php echo $listing->display_step_1(); ?></div>
    <?php endif; ?>
    
    <?php if ( $listing->display_step_2() ) : ?>
        <h3>Step 2</h3>
        <div class="hp-listing__description"><?php echo $listing->display_step_2(); ?></div>
    <?php endif; ?>
    
    <?php if ( $listing->get_description() ) : ?>
    	<div class="hp-listing__description"><?php echo $listing->display_description(); ?></div>
    <?php endif; ?>
    capitalss2

    Hi friend @gabetu I see that you always help everyone and explain very well. I have a few questions for you: 1. How to change the order of the blocks: I want to have my ads first displayed images only then everything else how to do this I tried to do it through css it turns out that other blocks are attached to the images, what should I do? 2. I used the Elementor plugin to create a new profile page, how do I display %user_name% on this page? 3. How do I register the number of the image. For example: 1/8 at flipping 2/8 and so on

    gabetu

    Hi @capitalss2,

    Yes I’m trying to help whatever I can because even I’m a heavy user of Elementor I like the template system of hivepress based on blocks.

    1. If you mean moving the images block above title in single listing page would be possible by editing the templates files in a child theme or perhaps with a filter but I have to look into documentation.

    2. The php code for displaying the user name is <h4 class="hp-vendor__name"><?php echo esc_html( $user->get_display_name() ); ?></h4> perhaps you can use it in a shortcode function.
    I don’t recommend modifying the core files like user profile, register or login unless you know exactly what are you doing.

    3. I don’t understand exactly the question, if you mean something like “You have uploaded 1 of 8 images permitted” I know that something similar is on roadmap to be implemented in next versions.

    capitalss2

    @gabetu 1. Yes, please tell me what to do and how to do it. 2. This php code outputs a categorical error, I have a separate profile page and I want to display %user_name% and the user profile image of the user there. 3. I noticed on your site the publication date of the ad is displayed differently, how did you do it? For example: we have “20.04.2021” you have “added today 2021”. thank you in advance!

    capitalss2

    @gabetu By the way, I wanted to substitute the text instead of the fasfa star icon in the advertised ads <h6>my test</h6> but it still did not change

    gabetu

    @capitalss2,

    1. For changing the blocks order in single listing I think you need to override the file hivepress\includes\templates\class-listing-view-page.php in a child theme and change blocks order like ‘listing_images’ to ‘_order’ => 10 and then ‘listing_title’ to ‘_order’ => 20 and so on.
    I couldn’t find any working filter.

    2. You can use a php function and shortcode to get the user name, something like:

    function display_current_user_display_name () {
        $user = wp_get_current_user();
        $display_name = $user->get_display_name();
        return $user->display_name;
    }
    add_shortcode('user_name', 'display_current_user_display_name');

    and then use the shortcode [user_name], it should work.

    3. I didn’t changed anything for the creation date it’s the default setting.

    4. Also for changing the star icon of the featured block you need to override the template located in hivepress\templates\listing\view\listing-featured-badge.php and make your changes there also for adding some test after icon you need some css code like this:
    /*Featured badge*/
    .hp-listing__featured-badge{width:7.2rem !important}
    .hp-listing__featured-badge::after{content:’\00a0 FEATURED’;font-size:15px}

    Please create new topics for other questions it’s difficult to follow topics with unrelated subjects.

    capitalss2

    @gabetu Thank you so much for everything you said it all worked out!!! You’re a genius. I don’t even know how to thank you. 2. Please excuse me I made a mistake I need to display the First and last name.
    Is there a way to add the icon <i class= "fa fa-search" aria-hidden= "true" ></i> to the right side of the search bar.
    Once again I want to say thank you maybe you will send me your PayPal as a thank you I will send you a small amount!

    gabetu

    @capitalss2,

    Have you set Display name to Full Name in Hivepress settings ? https://ibb.co/k4vNZGT

    Please check this post https://hivepress.io/support/topic/how-to-do-a-search-icon-in-the-search-button/

    If you want to make a donation please donate to the developers of this nice plugin !

    capitalss2

    @gabetu Thank you, but I wrote it in css and for some reason it does not work, and it is also written in a separate search button, I need it to be written in the search bar as in the photo https://wampi.ru/image/RvFmY0I

    capitalss2

    @gabetu for example in hivepress there is also an icon only on the left side and I need it on the right side

    saberasyl

    @gabetu Hi I see you are a genius of answers! I like your kind soul. 1. Please tell me how to specify the number of ads 0 or not to specify this section for free ads at all so that the seller would be asked to choose a package every time when adding ads( so that there would be no limit and choose a package every time) What file should I change?. 2. Is it possible to somehow specify the filter icon in the search bar, the text “filter” I deleted in loco translate and still that would show the filter icon even without a search. 3. Is it possible to attach the advertise icon(fa-fa star) in the lower left part of the image without changing the block size. 4. In my mobile version, I want to specify the width of the images to the full screen(remove the margins on the right and left) wight: 100%; tried not working = (. 5. Can I specify filters when adding ads for bad words and the number of characters for title and description Thank you!

    kandwal

    thnaks

    saberasyl

    @gabetu ?

    gabetu

    @capitalss2,
    For adding a icon in to the search form input field try this css code:

    .hp-form__field--search.hp-form__field.hp-form__field--search::after {
    font-family:"Font Awesome 5 Free";
    content:"\f002";
    font-size:18px;
    float:right;
    margin-top:-40px;
    margin-right:20px;
    }

    The perfect solution requires modifying the core files.


    @saberasyl
    ,
    For adding a icon to the filter button try this css code:

    .hp-form--listing-filter button span::before {
    font-family:"Font Awesome 5 Free";
    content:"\f1de";
    padding-right:10px;
    }

    For choosing a package every time I think that you need to set the limit to 1.

    For moving the featured badge try to play with this code:
    .hp-listing__featured-badge {top:5rem !important}

    capitalss2

    @gabetu no method works, I added this code additionally css nothing happened =(

    capitalss2

    @gabetu is this the whole code or do you need to add something to it?.

    .hp-form__field--search.hp-form__field.hp-form__field--search::after {
    font-family:"Font Awesome 5 Free";
    content:"\f002";
    font-size:18px;
    float:right;
    margin-top:-40px;
    margin-right:20px;
    }

    I have exactly the same problem as you @saberasyl 4. In my mobile version, I want to specify the width of the images to the full screen(remove the margins on the right and left) wight: 100%; tried not working = (. 5. Can I specify filters when adding ads for bad words and the number of characters for title and description.
    what should we do?

Viewing 20 posts - 1 through 20 (of 33 total)

You must be logged in to reply to this topic.