Support

Account

Forum Replies Created

  • First part may be solved with…

    [snip]

    working on it

  • Curious if anyone has any thoughts, please.

  • Adding define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php worked…

    … But I would still welcome comments about my memory usage.

    (As long as they don’t include: “Turn back and don’t use this complex field set you have spent more than a month building”).

  • John,
    In the last couple of days, I have been hacking away at building what seems to have become a Bootstrap-infused, semi-visual CMS builder inside WordPress, dependent on ACF.

    It struck me that, if I was going to use ACF in any way at all like this, i had to roll up my sleeves. I’m very happy with what I’ve been able to achieve so far, even if it is i) fairly tied to my own theme requirements and ii) perhaps even pretty messy and rough-‘n-ready.

    I made an ACF field group applied only to pages, and am running everything off one Flexible Content field, which itself contains multiple layouts, many of which themselves contain layouts, fields and what-have-you. It’s a nested, hierarchical mindbender, and just the kind of pseudo-programming task I enjoy. I did it this way because this seemed like the only way of guaranteeing I could drag around top-level elements.

    All code is output only in to the page.php, which contains a number of if statements corresponding to the different containers. Now I can create new container divs in the WordPress/ACF backend, and have a number of UI switches, boxes and buttons, whose values are typically classes that I output in the relevant places if available.

    I have certainly spent more time on this than I otherwise would have had I simply written what is going to be only a small set of pages for my new site, but I feel a) like am learning a bit and b) like I am building something more foundational than that.

    I am now part-way through re-casting my home page, which had previously existed as a flat HTML page, as WordPress page ACF content. There’s something strangely satisfying about that. Next up, I then aim to create a set of containers for inner pages from scratch in the tool.

    Here is what the beast looks like, only partly expanded.

  • For the record, I am having a little success with the following…

    <div class="col-md-12 cxt-title <?php
                                        // if "centre" radio selected, use relevant bootstrap 4 classes
                                        if( get_sub_field('jumbotron_horizontal_alignment') == 'Centre' ):
                                        	echo 'd-flex text-center justify-content-center';
                                        elseif( get_sub_field('jumbotron_horizontal_alignment') == 'Left' ):
                                          echo '';
                                        endif;
                                        ?>"><!-- for left align, remove d-flex text-center justify-content-center  -->

    That is – jumbotron_horizontal_alignment is a radio button with possible values “Centre” or “Left”. If “Centre”, echo out the three Bootstrap 4 classes that centre-align the text. If “Left”, echo nothing.

    I am learning a bit more ACF today, winging it a bit.
    (Meanwhile, also learning Bootstrap 4! I’m not certain that left alignment shouldn’t also be controlled using text-left and justify-content-start, but left seems to be the default).

    The above portion forms part of my overall Jumbotron layout…

    <?php
    
    // check if the flexible content field has rows of data
    if( have_rows('page_components') ):
    
         // loop through the rows of data
        while ( have_rows('page_components') ) : the_row();
    
            if( get_row_layout() == 'jumbotron' ): ?>
    
              <!-- jumbotron -->
              <div class="jumbotron jumbotron-fluid mb-0 cxt-bgimg <?php the_sub_field('jumbotron_height');?> cxt-bgimg-tint-default <?php the_sub_field('background_image');?> text-white d-flex justify-content-center">
                <div class="container align-self-center">
                  <div class="row">
                    <div class="col-md-12 cxt-title <?php
                                        // if "centre" radio selected, use relevant bootstrap 4 classes
                                        if( get_sub_field('jumbotron_horizontal_alignment') == 'Centre' ):
                                        	echo 'd-flex text-center justify-content-center';
                                        elseif( get_sub_field('jumbotron_horizontal_alignment') == 'Left' ):
                                          echo '';
                                        endif;
                                        ?>"><!-- for left align, remove d-flex text-center justify-content-center  -->
                      <div class="align-self-center p-3">
                        <h1 class="display-4 pb-2"><?php the_sub_field('jumbotron_title');?></h1>
                        <p class="lead pb-4"><?php the_sub_field('jumbotron_subtitle');?></p>
                        <?php
                        // check if the flexible content field has rows of data
                        if( have_rows('button') ):
                             // loop through the rows of data
                            while ( have_rows('button') ) : the_row();
                                if( get_row_layout() == 'button' ):
                                  echo '<a class="btn btn-primary pmd-ripple-effect btn-lg" href="' . get_sub_field('button_url') .'" role="button">'. get_sub_field('button_title') .'</a>';
                                endif;
                            endwhile;
                        endif;
                        ?>
    
                      </div>
                    </div>
                  </div>
                </div>
              </div>
    
            <?php endif; ?>
    
            <!-- Other layouts snipped from here -->
    
        <?php endwhile;
    
    else :
    
        // no layouts found
        echo 'No ACF layouts';
    
    endif;
    
    ?>
    
    
  • I lost / can’t find my data, having made the change via SQL query.

  • @elliot Really feels like ACF could be doing this for us.

    Can’t think of a situation where I would want to rename the field and not also have that reflected on the site.

  • I’m afraid I don’t quite understand the solution.

    Use case (refined) is:

    jumbotron_horizontal_alignment could be either “Left” or “Centre”.

    • If “Centre”, write out “d-flex text-center justify-content-center” (which is three classes) in to my HTML
    • If “Left”, do nothing (there are no classes associated with left alignment, since it is the default.

    I modified like this…

            if (get_field('jumbotron_horizontal_alignment') = 'Centre') {
              echo 'd-flex text-center justify-content-center';
            }

    … But WordPress threw this…

    Fatal error: Can't use function return value in write context in /home/mysite/public_html/wp-content/themes/mytheme/page.php on line 32

  • FWIW/Post-script –

    I now see that “row”, “block” and “table” refer to the method of presentation of layout labels and their entry forms. Wasn’t at all clear – but it is now that I know.
    So I presume a “table” layout has nothing to do with the table HTML tag at all – all three options are just for specifying backend view.

    I am finding some success with deploying one single “field”, containing multiple layouts. Reason being, I want to drag those “layout” components around. It’s a joy to see my Bootstrap components move around in order depending on how I drag and drop these ACF layouts in the field.

  • Oh, my, now I’m getting wrapped up in nests!

    Whilst I have so far been able to arrive at a reorderable single component, I see that, if I add a field on the same level, it is fixed, not draggable.

    I suspect/hope the answer to full reordering lays in nesting Flexible Content fields somehow.

  • Very confused about some of this, to be honest. But I appreciate your help, John.

    I guess I still have some things to learn about ACF – my use has been quite narrow so far.

    FWIW, my current use case is roughly the one we discussed in another thread … trying to create a system to make it easy for me to assemble pages from re-usable components.

    In that thread, I guess I started with a specific question/intention about a system that knows all Bootstrap 4 mark-up and would allow me to create, drag and drop new components in the moment, as it were.

    As I begin to think about it and Google around, I began to think that this, if it were not already available, may be overkill… that perhaps I could accomplish the same effect with just the Flexible Content add-on.

    The reason being, I don’t envisage my current set of pages diverging in design too much or me needing to add new and different Bootstrap 4 components directly on to the page. My small set of pages has a big degree of commonality.

    I am thinking perhaps I can just create a number of Flexible Content fields with my mark-up stored against them, then write write out the dynamic field content inside my mark-up, with possibly a few simple options and the ability to drag these “blocks” around.

    I am presuming the mark-up then would be stored inside the page.php itself. I will look at writing out specific CSS class selectors depending on radio button selected, for example.

    That’s what I’m currently testing.

    I think this is the basic intended function of the Flexible Content add-on, yes?

    So far, I love the result. Though I am early in.
    I envisage needing to learn how to nest conditional statements in the output code, ie. if we are using a homepage (tall) jumbotron, then write out one CSS class, but if we are using a standard landing page jumbotron (shorter), write out the alternative CSS class.

    Also, given that I’m using Bootstrap, I will also need to shed my confusion about the word “rows” 😉

  • “Layout: Table, Block or Row, refers to a repeater type field and not a flixible content field.”

    See this screengrab – … the “Layout” dropdown beside “Layout”.
    I am using ACF 5.5.9

  • Great minds think alike. I opened an issue on Github.

  • A couple of things…

    1.
    If I created a field group to show if Taxonomy Term is “myterm” BEFORE the 5.5 update, and that group was enabled, but, if memory serves correct, I never saved any info to that term… is there anything that I need to go and delete/update?
    (I had created the field group in November in anticipation of the 5.5 update coming).
    Bit of a newb on this, but what should I be looking for and where? Visual inspection of wpbc_options and wpbc_termsmeta don’t show anything relating to “myterm” in either – which I think would tally with never having saved any.

    2.
    For the last couple of weeks, I have been seeing a log error pertaining to term meta, as follows…

    [01-Dec-2016 13:51:10 UTC] WordPress database error Table 'brainclo_bgcv10.wpbc_termmeta' doesn't exist for query SELECT term_id, meta_key, meta_value FROM wpbc_termmeta WHERE term_id IN (75) ORDER BY meta_id ASC made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, WP_Stream\Plugin->init, WP_Stream\Connectors->__construct, WP_Stream\Connectors->load_connectors, WP_Stream\Connector_Menus->get_context_labels, get_terms, WP_Term_Query->query, WP_Term_Query->get_terms, update_termmeta_cache, update_meta_cache

    On occasion, the site has completely died, needing restore from backup, though not clear if this is the cause (this error is also produced without the site dying).

    Now, I could certainly believe this is something to do with the Stream activity-logging plugin I have activated… but I’m also curious if it relates to the term-related activities I have carried out using ACF, ie. creating a field group to load and save data on term meta edit pages (as above).

    Feels like, because ACF has set this field up, somehow Stream is expecting to find data from it?
    Also, the error is quite right that there is no table “wpbc_termmeta” – it is, in fact, “wpbc_termsmeta” (with an “s”).
    Why am I seeing “termSmeta”. Did the ACF DB upgrade script do this?

    Apologies if I’m barking up the wrong tree and should be looking to Stream, but something’s not connecting up.

  • John,
    That sounds very clever. It will move them over and wipe traces from options?
    That would indeed convince me to just run with the field group form now.

    Thanks!

  • Thanks, John.
    I understand the code… until we get to 5.5, capture ACF fields from options, copy them to term meta and destroy the versions in options, I guess.

    But I think implementing is beyond my skillset.
    So maybe I will just reinstate the field group in readiness for 5.5.

  • I have unpicked the ACF field group I had planned to use for this, pending the 5.5 release.
    I wanted to get it going in the meantime by writing in manual functions that work directly with term meta.
    But I finding it very hard going, understanding how to do this.

    Does anyone know a workaround, a way to display, save to and read from extended meta boxes on term pages, that does work directly with term meta, not options?

    Thanks.

  • Well I guess I’m just going to have to mess up my options table until then.

    5.5… should be… by year’s end… ?

    Thanks for the reply.

  • I have just saved checked some taxonomy items in several of my taxonomy fields displayed by ACF on an Edit User page, and clicked Update User.

    The items come back with checkboxes still ticked on the page reload.
    So, in what way does/did “User taxonomies” not work with ACF?

    (FYI, I am on ACF Pro 5.3.9.2)

  • @elliot

    Please could I back up a bit to understand this and what it means for me… ?

    1. So, previously, with ACF, I could add a Taxonomy field to an Edit User page? (I have successfully done this – both standard “Categories” taxonomy and multiple custom taxonomies).
    2. But, although ACF could successfully show the Taxonomy dropdowns/checkboxes, it could not save to them, so as as to link the User to the Taxonomy?
      Now, you have made a change to support this?

    But…

    • Does this mean I should still be using a separate plugin, ie. LH User Taxonomies, in conjunction with ACF?
    • Or can I now do this just with ACF, as long as I set up a Taxonomy ready for ACF?

    In my case, I want to categorise my Users using some custom taxonomies. I have already set up two custom taxonomies for this (“Industries” and “Companies”).

    So, if I now use ACF to add them as fields to my Edit User pages, will they successfully save as a result of your upgrade? Or do I still need to be employing LH Taxonomies?

    One caveat/FYI: I had previously registered my custom taxonomies using manual code in functions.php, but currently they are set up using WCK, Worpress Creation Kit.
    Now, is it relevant that WCK’s Taxonomy Creator includes an option to “Attach” my taxonomies to: “post”, “page” and “mycustomposttype” (in other words, it only shows options for Posts, not Users)?

    Will ACF be able to successfully connect with these taxonomies, I wonder? Will it override the WCK setting?

  • I self-solved this.
    It was my mistake.
    I had chosen rules “If Post Type is User” (which doesn’t make sense to me) rather than the correct “If User Role is All”.

    Mark solved/delete if you like, admin.

  • @John Huebner:
    Thanks for the tips.

    I think I’ve got this working.
    I changed the references to the field name, and I commented-out the extension validation.
    I now have an image showing beneath my URL textbox.

    So I guess this will now try to interpret ALL URL field types as images, is that right?
    If so, sounds like it would be useful to be able to create a separate field type and have that be the image-from-a-URL.

    Thanks.

  • Thanks.

    How do I implement this?
    I haven’t yet implemented a filter for ACF.
    I pasted your code to functions.php, minus the enclosing PHP tags.
    I don’t see any new field type added.
    Is this supposed to change how the existing URL field type operates, displaying the image?
    It doesn’t do that, it just shows the URL.

    Thanks.

  • Solved this by buying Pro with Label Positioning setting.

  • Umm…

    I just accidentally reloaded the ACF-Upgrade page whilst it was still loading.
    It immediately refreshed to the “compete” page:

    Advanced Custom Fields Database Upgrade
    Reading upgrade tasks…

    Upgrading data to version 5.3.9.2

    Database Upgrade complete. See what’s new.

    This rather suggests the operation was complete hours ago.
    Unfortunately, I only discovered this by accident, four hours after I clicked “upgrade”.
    Something obviously went a bit wrong. Don’t know if it was due to the size of my database or what.

Viewing 25 posts - 76 through 100 (of 107 total)