Forum Replies Created

Viewing 30 posts - 1 through 30 (of 64 total)
  • Author
    Posts
  • in reply to: Post Grid not working #1405623

    Good morning,

    Thanks for that. That bit you pasted above made me realise that there is code in there that used to be commented out, but it snow part of the live code. I think it was something copied from the internet that was supposed to be temporary. A few weeks ago the website crashed and i had to revert to an old website backup, im guessing tis file was part of the backup.

    In any case im confident that i can figure it out from here.

    thanks for your help, much appreciated.

    in reply to: Post Grid not working #1405465

    hello, i think the custom code was for displaying custom fields on the post grid. i have pasted hte whole file below but you can find a copy of it on the link i sent above.

    thanks for your help

    in reply to: Post Grid not working #1405336

    hey, thanks for the tip. I started looking into it and found that the problem is with the postslider.php file in my child theme.

    unfortunaltely this was a file that was customised with help from your support team a couple years ago. I have no idea whats what. It seems quite different from the new theme file and i cant really tell what part of the update and what was customisation.

    i have made a copy of the file and uploaded it where you can find it, link below

    in reply to: Post Grid not working #1405116

    Thanks Mike,

    Unfortunately that was the first thing i tried, i reverted back to 4.8 when things started breaking. Apologies i forgot to update it again.

    I have updated again to 5.5 but the problem persists.

    in reply to: Post Grid not working #1404897

    Hey,

    I have made a copy of the website, login below. I have tried disabling other plugins etc but couldn’t get it working.

    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>’;

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