Forum Replies Created

Viewing 30 posts - 1 through 30 (of 59 total)
  • Author
    Posts
  • in reply to: add class to get_the_term_list #1322155

    ok thanks. details below

    in reply to: add class to get_the_term_list #1321856

    It seems that now every post has ‘Array” just under the title. The placement is good but i don’t know why they all say ‘Array’.

    I added a custom field called price and a value. Also tried with a capital P but same result.

    Do i need to use ACF to do this? im just using the built in custom field options.

    Also am i still supposed to add the first chunk of code you added? where does that go? everywhere i put it i get the error “syntax error, unexpected ‘,’ expecting t variable’. If i save it anyway the website crashes.

    in reply to: add class to get_the_term_list #1321565

    sorry was logged in with wrong account

    in reply to: add class to get_the_term_list #1320841

    The custom post is called ‘Advertisements’ and there are a bunch of taxonomies. The one that i am most interested in customizing is called ‘Price’ and i don’t really know what you mean about terms? each product has a different price?

    Essentially its a custom post with a price associated with it. I need that to show up on the postslider.php when i list all the posts.

    in reply to: add class to get_the_term_list #1320630

    It seems that now all the taxomonies have a class of stray.

    I change this:
    if(in_array($term->name, array(“kitty”, “pussy”, “catty”))) {
    $cat_class = “pets”; }
    to be:

    if(in_array($term->name, array(“price”, “Price”))) {
    $cat_class = “price”; }

    so that it matched the taxonomy im looking at. However its still has ‘stray’ as a class instead of ‘price;

    in reply to: add class to get_the_term_list #1320142

    Thanks Ismael,

    That makes sense, but the problem now is that its only showing one taxonomy – the brand. All the other are no longer visible.

    Another problem is that its using the brand name rather then the taxonomy name. For example it looking for a brand called brand1 and giving it the class i have assigned, but its ignoring brand2 etc. So if i apply this to the product price, I cant give a class to all prices, only one particular number?

    in reply to: add class to get_the_term_list #1319839

    ok i see, sorry i dont know php at all and i am fumbling through without a clue. I have taken the example you sent and replaced the the terms with myown, however is still don’t know hoe to incorporate it into the $cats variable:

    $terms = get_the_terms( get_the_ID(), ‘price’ );
    if ( $terms && ! is_wp_error( $terms ) ) :
    $price_links = array();
    foreach ( $terms as $term ) {
    $price_links[] = $term->name;
    }
    $price = join( “, “, $price_links );
    ?>
    <p class=”price”>
    <?php printf( esc_html__( ‘price: <span>%s</span>’, ‘textdomain’ ), esc_html( $price ) ); ?>
    </p>
    <?php endif; ?>

    I tired pasting the above into several places of the postslider.php file but it just causes fatal errors everywhere and breaks the whole site. Unfortunately its not as straight forward as a page template.

    in reply to: add class to get_the_term_list #1319814

    also tried the below code which seems to add a number 1 after the other terms on the front end, but only on the first product:

    if( ! empty( $title ) || in_array( $show_meta_data, array( ‘always’, ‘on_empty_title’ ) ) )
    {
    if( true )
    {
    $taxonomies = get_object_taxonomies( get_post_type( $the_id ) );
    $cats = ”;
    $excluded_taxonomies = array_merge( get_taxonomies( array( ‘public’ => false ) ), array(‘post_tag’,’post_format’, ‘show’, ‘seller’, ‘selleremail’, ‘show_wanted’, ‘price’) );
    $excluded_taxonomies = apply_filters( ‘avf_exclude_taxonomies’, $excluded_taxonomies, get_post_type( $the_id ), $the_id );
    $terms = get_object_term_cache( $post->ID, $taxonomy );
    $term_ids = wp_list_pluck( $terms, ‘price’ );

    if( ! empty( $taxonomies ) )
    {
    foreach( $taxonomies as $taxonomy )
    {
    if( ! in_array( $taxonomy, $excluded_taxonomies ) )
    {
    $cats .= get_the_term_list( $the_id, $taxonomy, ”, ‘, ‘, ” ) . ‘ ‘;
    $cats .= wp_cache_add( $post->ID, $term_ids, $taxonomy . ‘price’ );

    }

    }
    }

    in reply to: add class to get_the_term_list #1319812

    Thanks for the response Ismael,
    The example given says i need to add the taxonomy term_id, is that the same as the slug?

    And the postslider.php file adds everything to the $cats variable to make it show on the front end. So to add the ‘price’ taxonomy i would do this?
    $cats .= wp_cache_add( $post->ID, $term_ids, $taxonomy . ‘price’ );

    Here is the whole code i added, but it seems to break the whole website so i had to remove it.

    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, ‘price’ );
    $cats .= wp_cache_add( $post->ID, $term_ids, $taxonomy . ‘price’ );
    }
    }

    in reply to: filter custom taxonomies #1307873

    actually one more thing,

    is there a way to tell which template i need to edit for specific archives? the archive pages for my custom posts are not displaying the ‘read more’ link. For example, compare the home page which uses postslider.php, to the page linked below

    in reply to: filter custom taxonomies #1307864

    all good you can close this

    in reply to: filter custom taxonomies #1307669

    Perfect!

    Thanks Ismael everything is working great

    in reply to: filter custom taxonomies #1307408

    I have reset the password below. It shouldn’t expire, its not a temporary account.

    in reply to: filter custom taxonomies #1307081

    Thanks i was able to edit the array and remove unwanted taxonomies, however the duplicates are still there.

    Yes i reverted the to the original postslider.php before updating the new one in my child theme. I even tried downloading the theme again and copied the fresh file to my theme to make sure its the same as the original. I used an online diffchecker to make sure that the two files are exactly the same except for the code to show the taxonomies.

    in reply to: filter custom taxonomies #1306634

    Also,

    The code given to me is showing duplicates. For example the first post shows all the taxonomies once, the second post shows all the taxonomies of the first post AND second post, the third post shows the taxonomies of the first, second and third post etc.

    in reply to: Featured image being cropped #1306633

    Actually ignore that, i regenerated the thumbnails about 100 times and it finally worked. Not sure why it wasn’t working earlier since i changed browser to avoid caching issues. In any case everything is working as expected now so you can close this .

    thanks

    in reply to: Featured image being cropped #1306631

    Hello,

    I have tried using a much larger photo but it didn’t make a difference. I even tried to install the simple image sizes plugin that you recommended but the photos are still being cropped.

    i have remade a login for you below

    in reply to: custom post archive #1305904

    Thank you, however only the first post is displaying correctly, all the the other posts show the word “Array” in front of the list of taxonomies?

    For example :
    ArrayBrand 1

    instead of just:
    Brand 1

    in reply to: Featured image being cropped #1305146

    Hi Ismael,

    I have tried this:
    1. completely re-uploaded new images
    2. used the media replace plugin to replace the existing images
    3. used the regenerate thumbnails plugin

    The original size of the photo ( the last photo that i tested ) is 500×900 pixels. I get that this is not a square photo, but i will be relying on clients uploading these images so i can’t manually crop photos for everyone. I just need the featured image to not crop photos, even if it means having a smaller photo.

    in reply to: custom post archive #1304358

    Your a legend! that works perfectly. This has been plaguing me for weeks.

    Now to add the other taxonomies i repeated the whole chunk of code above and replaced the taxonomy name. It works but there will about 8 taxonomies to display so that’s a lot of code, is there a way to condense it?

    in reply to: Featured image being cropped #1304321

    Hi Ismael,

    Sorry for the slow reply, i have been preoccupied with the other thread. I have added the code you gave me to functions.php and played with the image sizes, however the image still gets cropped regardless of the size. I have tried changing the size of the image containers and overlay image etc using css but even if the container is much larger than the photo it still gets cropped?

    in reply to: custom post archive #1304318

    ok its working now, it must have been my browser acting up. However its still not showing on the home page?

    in reply to: custom post archive #1304311

    Hi Ismael,

    Something strange has happened. When i first visited your link it looked like it worked. I could see ‘Brand: Brand 1’. However after a refresh it disappeared? I can see the code you entered to the postlisder.php file is still there. Not sure why its not showing, i have cleared my browser cache.

    Also, It didn’t appear on the website home page where all the advertisements are displayed. Will this only work on individual taxonomy archive pages or should this work on the home page too?

    in reply to: custom post archive #1303482

    Hello,

    The slug is just brand-1, brand-2 brand-3 etc. I have added a new password for the login below. You can findall the taxonomies by visiting the Advertisements tab.

    I tried adding the above code to postslider.php but it gave me a syntax error: unexpected T_constant_Encapsed_string, i played around with the quotation marks but it was giving me wierd results on the front end. Not sure where i went wrong. I have added anther link below with a copy of the postlisder.php file and single.php file so give you a better picture of what i am working with.

    Hopefully that helps?

    in reply to: custom post archive #1302731

    I think the problem is the syntax of the php. I don’t really know enough about php to be sure, but by the look of it i shouldn’t need to open the php tags before ‘the terms..’

    Since this whole thing is happening inside the $output variable.

    $output .= ! empty( $excerpt ) ? “<div class=’slide-entry-excerpt entry-content’ {$markup}>
    <p>terms should show here:<?php the_terms( $post->ID, ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ ); ?></p>

    {$excerpt}</div>” : ”;
    $output .= ‘</div>’;

    in reply to: custom post archive #1302730

    Hello,

    Couple problems. Firstly this is editing the blog page, i am trying to edit the archive page – postslider.php. The code you gave me above will add the brand taxonomy to the blog page but i have already done that with the single.php.

    Next problem is that the code above is displaying the Brand taxonomy as expected, but it looks like this:

    Brands: <span>Brand 2</span>

    Its adding the <span> tags as text not HTML

    This is similar to the problem i am having on postlisder.php, where the php is being rendered as text:
    <p>
    <!–?php the_terms( , ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ ); ?–>
    </p>

    the actual slug i am using are:
    ‘advertisements’ – post type
    ‘brands’ – taxonomy

    There are a whole lot of other taxonomies but if i can get one working then i can get the rest working.

    in reply to: custom post archive #1302107

    Hi Ismael, I have tried using all of the below without success:

    get_the_terms( $post->ID, ‘advertisements’ );
    get_the_terms( $post->ID, ‘brands’ );
    get_the_term_list( $post->ID, ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ );
    get_the_term_list( get_the_ID(), ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ );
    the_terms( get_the_ID(), ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ );
    the_terms( $post->ID, ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ );
    get_the_term_list( $the_id, ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ );

    I think i was using the last one when I got the weird result i mentioned earlier.
    Not sure what i did wrong? I have added more code below to give some context for where i added it.

    $output .= ‘</header>’;
    if( ( $show_meta && ! empty( $excerpt ) ) || in_array( $show_meta_data, array( ‘always’, ‘on_empty_content’ ) ) )
    {
    $meta = “<div class=’slide-meta’>”;
    if ( $commentCount != ‘0’ || comments_open( $the_id ) && $entry->post_type != ‘portfolio’ )
    {
    $link_add = $commentCount === ‘0’ ? ‘#respond’ : ‘#comments’;
    $text_add = $commentCount === ‘1’ ? __( ‘Comment’, ‘avia_framework’ ) : __( ‘Comments’, ‘avia_framework’ );

    $meta .= “<div class=’slide-meta-comments’>{$commentCount} {$text_add}</div><div class=’slide-meta-del’>/</div>”;
    }
    $markup = avia_markup_helper( array( ‘context’ => ‘entry_time’, ‘echo’ => false, ‘id’ => $the_id, ‘custom_markup’ => $custom_markup ) );
    $meta .= “<time class=’slide-meta-time updated’ $markup>” . get_the_time( get_option( ‘date_format’ ), $the_id ) . ‘</time>’;
    $meta .= ‘</div>’;

    if( strpos( $blogstyle, ‘elegant-blog’ ) === false )
    {
    $output .= $meta;
    $meta = ”;
    }
    }
    $markup = avia_markup_helper( array( ‘context’ => ‘entry_content’, ‘echo’ => false, ‘id’ => $the_id, ‘custom_markup’ => $custom_markup ) );
    $excerpt = apply_filters( ‘avf_post_slider_entry_excerpt’, $excerpt, $prepare_excerpt, $permalink, $entry );
    $output .= ! empty( $excerpt ) ? “<div class=’slide-entry-excerpt entry-content’ {$markup}>

    <p>
    <?php the_terms( $post->ID, ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ ); ?>
    </p>

    {$excerpt}</div>” : ”;
    $output .= ‘</div>’;
    $output .= ‘<footer class=”entry-footer”>’;

    in reply to: custom post archive #1301255

    hmm i think i will need to create a new taxonomy with only one option, assign it to all posts and hide it from the front end. Is it possible to make a taxonomy selected by default so all posts have it automatically?

    Also, i have tried editing postslider.php but i am having a really strange issue there. I have added the code below:
    <p><?php the_terms( $post->ID, ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ ); ?></p>

    Which works as expected on single.php, but on the front end it is showing like this:
    <p>
    <!–?php the_terms( , ‘brands’, ‘Brand: ‘, ‘, ‘, ‘ ‘ ); ?–>
    </p>

    As if the opening tag for the PHP is being interpreted as a HTML comment?

    in reply to: Featured image being cropped #1301086

    Hi Ismael,

    This plugin hasn’t been updated in over 2 years. I don’t really want to rely on a plugin that is no longer supported. Does Enfold have a built in way to change featured image size for posts with sidebars? Or something i can add in the functions.php?

    thanks

    in reply to: custom post archive #1300862

    thanks i will look into the postslider.php file.

    I removed the avia block and started again. I managed to get everything showing, however now its showing pages to i.e. Contact Us, Privacy policy etc.

    I need to show my custom ‘advertisement’ post type only, and it isn’t one of the options. It is only displaying the taxonomies so i cant select all of them.

    So the way it is structured is:

    -Advertisement post type
    —taxonomy 1
    —taxonomy 2
    —taxonomy 3
    —taxonomy etc

    But the Blog post Element only has:
    —taxonomy 1
    —taxonomy 2
    —taxonomy 3
    —taxonomy etc

    If i select one of the taxonomies then its not showing all the posts, only the posts in that taxonomy.

    I have disabled post categories so there shouldn’t be an issue with one of the posts being uncategorised.

Viewing 30 posts - 1 through 30 (of 59 total)