We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 37 total)
  • Author
    Posts
  • in reply to: Custom Fields #13247
    Cris
    Participant

    Perfect!! I have learned a lot with this. Thanks a lot Tom!!!

    I have proven that without ‘ . $term->slug . ‘ it also works.

    in reply to: Custom Fields #13245
    Cris
    Participant

    Perfect!!! Thanks a lot Tom !!

    in reply to: Custom Fields #13219
    Cris
    Participant

    Hi Tom, somebody told me that get_the_terms() retrieves the terms of the taxonomy that are attached to the post, but I can’t make it work. To make it works with WPSP, what should I change and where do I add the names of the taxonomies?

    function get_the_terms( $post, $taxonomy ) {
        $post = get_post( $post );
        if ( ! $post ) {
            return false;
        }
     
        $terms = get_object_term_cache( $post->ID, $taxonomy );
        if ( false === $terms ) {
            $terms = wp_get_object_terms( $post->ID, $taxonomy );
            if ( ! is_wp_error( $terms ) ) {
                $term_ids = wp_list_pluck( $terms, 'term_id' );
                wp_cache_add( $post->ID, $term_ids, $taxonomy . '_relationships' );
            }
        }
     
        /**
         * Filters the list of terms attached to the given post.
         *
         * @since 3.1.0
         *
         * @param WP_Term[]|WP_Error $terms    Array of attached terms, or WP_Error on failure.
         * @param int                $post_id  Post ID.
         * @param string             $taxonomy Name of the taxonomy.
         */
        $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy );
     
        if ( empty( $terms ) ) {
            return false;
        }
     
        return $terms;
    }
    in reply to: Custom Fields #13183
    Cris
    Participant

    Keep showing all the taxonomy data, instead of showing the one that corresponds to each entry.
    You can see it here
    the first one on the left should show only the value 0, and the others the value 3 and 4 respectively. But all the taxonomy values (0, 1, 2, 3, 4) appear in each of the entries.

    in reply to: Custom Fields #13166
    Cris
    Participant

    That code doesn’t work properly, Tom. I explain:

    Within the “dormitorio” taxonomy I have the values 0, 1, 2, 3 and 4 (these are the room numbers). If an entry has only the value 3 marked, only that value should be shown but it does not do well because it shows all the values 0, 1, 2, 3 and 4. How can it be solved and how can include several taxonomies with diferents classes in this code?

    $terms = get_terms( ( array('taxonomy' => 'dormitorio', 'hide_empty' => false,)));
    
        if ( isset( $terms ) && '' !== $terms ) {
            foreach( $terms as $term ) {
                echo '<div class="tax dormitorio">';
                echo $term->name;
                echo '</div>';
        }
    in reply to: Custom Fields #13106
    Cris
    Participant

    I have created a type of personalized entrance with several taxonomies as categories (dormitorios, tipo, zona…). When using WPSP, it shows each personalized entry with its categories. The code you provided to show the categories shows all the fields created in that category, instead of showing the specific data of that entry. Look at the attached images:

    taxonomies
    shows all created data for dormitorios, when it should show only the dormitorios: 3

    You can see it live here

    in reply to: Custom Fields #13064
    Cris
    Participant

    Thanks Tom!
    I tried it and it shows all the data in the taxonomy, instead of showing the specific data that corresponds to each entry.

    $terms = get_terms( ( array('taxonomy' => 'dormitorio', 'hide_empty' => false,)));
    
        if ( isset( $terms ) && '' !== $terms ) {
            foreach( $terms as $term ) {
                echo '<div class="tax dormitorio">';
                echo $term->name;
                echo '</div>';
        }
    in reply to: Custom Fields #13033
    Cris
    Participant

    Thanks Tom, your code to add class works fine.

    I hope you don’t laugh at me but I’m not a developer:) I did this and only the word “Array” returns to me.

    
        $terms = get_terms( ( array('taxonomy' => 'post_tag', 'hide_empty' => false,)));
    
        if ( isset( $terms ) && '' !== $terms ) {
            echo '<div class="tax referencia">';
            echo $terms;
            echo '</div>';
        }

    Can you help me with taxonomies, please?

    in reply to: Custom Fields #13000
    Cris
    Participant

    Sorry, another thing.
    How can I customize the “custom fields” using css? I don’t know how to add classes or a icon image.

    I explain, because maybe I can’t do what I want:
    I am doing a real estate website and I want to use WPSP to display them on the home page. I would like to put below the photo, the characteristics (bedrooms, bathrooms, price, etc …).
    With the code you give, the custom fields appear pasted behind each other and I would like to add an icon or text in front of them. I also have some taxonomies that I want to place next to the custom fields.
    You can see what I am doing here.
    In addition to custom fields I am using taxonomies to be able to search with the Search & Filter plugin

    Thanks!

    in reply to: Custom Fields #12995
    Cris
    Participant

    Hi

    I used this code for the custom field “precio” and it works correctly:

    add_action( ‘wpsp_before_content’,’wpsp_add_custom_meta’);
    function wpsp_add_custom_meta()
    {
    $meta = get_post_meta( get_the_ID(), ‘precio’, true );
    if ( isset( $meta ) && ” !== $meta )
    echo $meta; echo “€”;
    }

    I want to do the same with 2 taxonomies (similar to categories), not custom fields, but that code does not work with them.

    in reply to: Custom Fields #12905
    Cris
    Participant

    Hi Tom,
    Your code works well with custom field but I also need to do the same with several taxonomies. How would it be done?
    Thanks

    in reply to: Can't see Carousel #12114
    Cris
    Participant

    Sorry Tom
    I set it wrong. Now it is solved.
    I’m sorry.

    in reply to: Can't see Carousel #12113
    Cris
    Participant

    I just realized that in the adaptive design view of Firefox, for developers, I do see the dots of the carousel. The dots disappears on the big screen. The same thing happens in Chrome.

    in reply to: Can't see Carousel #12111
    Cris
    Participant

    It still doesn’t work properly because they don’t behave like a carousel. The images should rotate and the dots appear below.

    in reply to: Can't see Carousel #12103
    Cris
    Participant

    I deactivated Autoptimize and it is still not functional

Viewing 15 posts - 1 through 15 (of 37 total)