Support

Account

Forum Replies Created

  • Thank you very much, John. Yes, I’ll be very careful…and make absolutely certain to backup first.

  • Thank you, John. So if you have to inspect data, then you wouldn’t recommend wp-optimize because it does not offer enough choices or offers too many for a novice to understand? Does it have perils regarding that conditional logic? I understand it to a point, but have difficulty where there are situations of intersecting data but my need is to focus on what the two named groups don’t have in common, etc.

    What about for the easy-to-delete unused data from a non-existing field? I’m a little leery of going into my database itself exactly because I’m so new.

  • I’d like to know too. Thanks. I was looking into a plugin called wp-optomize ( https://wordpress.org/plugins/wp-optimize/ ) and didn’t know if it was something anyone here has used.

  • I finally had to give up and use the Toolset Types plugin, which has some of the ACF function and inserts some of the custom field code into the wordpress itself. I can see two problems with this:

    1. It’s doing the dirty work for me. I still don’t know where it is putting the code or how it works.

    2. If I make a mistake or change my name about which field name to use, it could leave a trail of unused fields and code. I don’t know if that’s what it does, but I have no way of verifying either because I don’t know where it is inserting code into the theme.

    But after using it, I could use this snippit

     <?php if (get_the_term_list($post->ID, 'media-type', '', '<br />', '')): ?>
      <div>
      <h4><?php esc_html_e('Media:'); ?></h4>
      <div>
      <?php
      echo get_the_term_list($post->ID, 'media-type', '', ',&nbsp;', '');
    ?>
                                   </div>
                                </div>
    <?php endif; ?> 

    because now I have another custom category type built into my wordpress (right along side the existing “category” and “tag” options in wordpress).

    I also found out that the spaces (”) in places like this
    echo get_the_term_list($post->ID, 'media-type', '', ',&nbsp;', '');

    actually serve as a substitute for the

    if( count($values)){
        foreach($values as $k=>$value){
            if($k) echo ',  ';
           echo $value;
        }
    }

    part of the code and that it isn’t a good idea to use “if (count($values))” if the value is ever empty, but some of the problems associated with using anything with “empty()” was way over my head. Maybe someone can come along later and explain how someone could have an archive link (that part was solved by john) associated with the category name in a theme’s custom portfolio taxonomy.

  • Oh, interesting approach regarding the closing out of php. I like it. Kind of like formal writing avoids contractions. Probably a good approach for me too since I’m just learning the intricacies of php but am fine with most html.

    Name instead of label… So that’s how taxonomy’s handle things differently then? I was using a snippit for handling custom fields. I tried using a snippit my own theme uses as well…
    <?php echo get_the_term_list( $post->ID, 'portfolio_skills', '', '<br />', '' ); ?>
    (this time closing the tags rather than mess with all the single quotes…especially since I’m not worried about spaces and line breaks right now)

    However, since ‘portfolio_skills’ (I used ‘media’ instead) is my theme’s own custom field and probably not a taxonomy per se (albeit the values are user generated), maybe $terms->ID would be better $terms->NAME or will I break the theme again?

    Maybe a better question is to ask what would be a good resource for learning and practicing php? I’m like the person learning a new language asking for a “tall refreshing glass of water”. I know that I’ll get a glass of water without understanding that “refreshing” is superfluous and “tall” is too specific for my needs.

    Thanks again for all your efforts. I know it’s a labor of love teaching without pay.

  • Thanks, John.

    Sorry…I’m a bit cloudy about understanding exactly what ACF Pro does. I was confusing the flexible content field with something that would allow me to add a link to each choice, but further reading is leading me down a rabbit hole, so maybe it’s not the answer.

    Yes, that code works for links. So would I also use something like

    <a href="<?php echo get_term_link($term); ?> . echo $field['label'] . </a>

    to show the link as the name of the category? It’s not working so something isn’t right in my syntax. I’m a little confused as to when to use single quotes to indicate switching to html or single out items not native to php, and when to use the dots. Thanks again. You’ve helped tremendously already.

  • Pardon me for giving this another bump, but the more I read, the more it looks like purchasing the pro version might be the better solution…the linking option looks as if it might solve my problem?

    Could someone with little to no coding skills make use of it? Again, pardon my ignorance.

  • This reply won’t help your issue, but hopefully will help with the process…

    1. Responses may take a while here for free versions. In trying to find a solution for my problem, I’ve seen responses with a two week lapse or more.

    2. You might need to share your ACF settings. I really don’t know what I’m looking at, but maybe you have some conditional logic settings, and one of those might be causing the issue.

    3. You will also probably have to share any code you are using in your template.

    4. If you are like me, I don’t know if I’m explaining my issue clearly enough or even have it under the right topic to be answered. So continuing the search might still be our best option. Good luck.

  • To clarify now that I understand more:

    I am using my theme’s existing custom taxonomy portfolio-category, but I don’t know how to perform a var_dump of that field (assuming it’s a field and not a subfield) outside of the loop. I want to eventually be able to use each category I assign via checkbox a link, and to use my portfolio’s existing archive view to view the posts under that category.

    In my theme:
    I have one category in my theme’s ‘portfolio-category’ named ‘media’ (slug is also media) and five children assigned under that category:
    Acrylic (slug: acrylic-media)
    Textured Acrylic (slug: textured-acrylic-media)
    Digital (slug: digital-media)
    Prismacolor (slug: prismacolor)

    In ACF
    Field label: Media
    field name (slug?): media
    field type: Taxonomy
    Taxonomy: portfolio_category
    Field Type: Checkbox
    Term is ID, not object.
    Null is currently not allowed

    Since I’m using a taxonomy, using anything like [‘label’] would be out of the question (right?), which is why any of the sub-field snippits I tried did not work, and that a value of 5 from the var_dump was because there is 1 field and 4 sub-fields in my theme’s taxonomy assigned the field ‘media’. So if this method is too complex, then I could resort to another option and attempt to create my own archive function in the (probably distant) future…

    If checkbox were chosen instead of taxonomy, I could assign each category a label and a variable in the choices fields in ACF

    So something like

    acrylic: https://www.mysite.com/acrylic
    prismacolor: https://www.mysite.com/prismacolor
    etc.

    would work if I wanted to set a value to an ‘href’. But…

    I would have to call each subfield by name to retrieve the values from that field, right? Or would there be any way to assign a x-variable type value so I can just add what I wanted to ACF as I add more subfields? A pain, but not quite as much writing code for every subfield in addition to adding to ACF and therefore having two areas to edit.

Viewing 9 posts - 1 through 9 (of 9 total)