@thetexiandm Yeah sorry, IDK how I got around this. I have since switched to using Laragon for my dev environment though. It uses bitnami under the hood but it’s a more managed work environment.
Awesome, thanks so much for the info!
@westwords Yes. I used Macy.js which was just a much simpler implementation than the Desandro Masonry that’s more popular. http://macyjs.com/
Thanks. I’m not messing with it for now but I’d like to start integrating it into my blog cycle soon. Hopefully the update comes soon, but if not I’ll just be patient. Thanks again John! You’re always extremely helpful and I really appreciate that.
Yeah it has an endwhile. And there’s a closing div for img container I just accidently didn’t copy it over. I ended up getting it to work but by doing this:
if ( 'vertical' == get_field('center_vertical') ): ?>
<img class="side-project-img lazy" style="top:-300px; right:100px;" src="<?php echo get_the_post_thumbnail_url() ?>" />
<?php else: ?>
<img class="side-project-img lazy" src="<?php echo get_the_post_thumbnail_url() ?>" />
<?php endif;?>
Which is just a piece of code I copied from elsewhere on the forum so I think it was just some syntax issue I was overlooking, probably the spaces as you said.
Okay so I’ve got it working now. I think it might have just been the database needing to catch up or be refreshed. I uploaded a bunch of pictures without WP Media Folders and then inserted the gallery into a new page and it came out working correctly after some tweaks.
A couple of things worth noting. Part of the problem was [‘sizes’][‘full’] was not working at all. For some reason it seems my thing doesn’t get full images using the full keyword? It just comes up blank.
Second, part of the problem is that I forgot about the lazy loader loop I had made, so while I was applying changes to the php loop for the parts that loaded up afterwards, I wasn’t to the initial 5 images in the gallery, which is why I kept changing the code, and not seeing changes to the image elements that I was inspecting in the browser.
Got it working now!
I asked over at the support forums and found an answer! I just had to wrap them in an additional containing loop to the template. Full answer can be found here in case any future person searching the forums needs it:
<?php /* Template Name: Your Custom Template Name */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div>Your custom content, including any template tags you want to use like <?php the_post_thumbnail(); ?></div>
<?php endwhile; ?>
Okay I tried my idea but for some reason it’s not working. It’s getting the post ID for the post that I’m inserting stuff into, not the custom post that I’m inserting.
I could use get_the_ID but that gets the ID for the post that I’m actually in, not for the post that I’m drawing the gallery from. I have an idea though.
Okay so I found that in order to get the If and While to work I have to include the post ID number. The problem is making that dynamic…. looking that up right now.
Okay, it does indeed work with this plugin! Except for some reason my repeater plugin is saying that it’s not finding any rows. My loop starts like this
<section class="grid-content">
<div class="gridGallery">
<?php
// check if the repeater field has rows of data
if( have_rows('card') ):
// loop through the rows of data
while ( have_rows('card') ) : the_row();
And then I have this:
else :
?> <p>no rows found</p> <?php
// no rows found
endif;
And it seems that instead of pushing out all my gallery images it’s detecting zero rows and going to the else statement. I’m sure there’s an easy fix here I’m missing but I can’t catch it exactly…
I think I found a better plugin. This one seems to be able to insert custom fields and stuff. I’m looking through a tutorial to see if I can get it to work. https://wordpress.org/plugins/insert-pages/
Okay so I think the shortcode thing is probably in the right direction.
Here’s what I’m trying right now. I created a custom post type called “Galleries”. The only field group for it is the repeater that I mentioned earlier.
In order to insert a gallery in the middle of a blog post, my plan is to have a shortcode that injects one post (the custom Gallery Post ) into another.
I just trie ddoing this using this plugin: https://wordpress.org/plugins/post-content-shortcodes/
But it only seems to work for injecting The Content (from the WYSIWYG editor) and won’t pull in anything else from the php loop etc.
Any way of doing that? Or am I going to make my own shortcode etc using the codex?
Okay I’m using this post now to set up my lazy loading:
https://support.advancedcustomfields.com/forums/topic/lazy-loading-images/
But I’m running into some issues. Namely this:
Not sure what’s causing that problem.
Okay! I got lightbox working, using this post: https://support.advancedcustomfields.com/forums/topic/lightbox-images-in-custom-content-field/
and fancybox3 Very easy to set up etc. Now I just have to add in Lazy loading. Any suggestions on lightweight lazy loading apps that would fit well?
Hey how did you get this to work? I downloaded and installed the plugin, and then inserted your function into my code but it didn’t seem to work?
get_field('my_field', false, false)
isn’t working for me. It isn’t outputting the weird <p> tags problem but it’s not outputting anything either. Not sure why. Oh well, I found a work around. I just wish for the future it was clearer how to wrap a WYSIWYG output with a div and class instead of getting this weird <p> tag error. This issue goes a long ways back in the forum, I can tell, but everyone just gets around it by stripping the tags using a function, but that doesn’t really address the fundamental issue as far as I can see.
I am such an idiot. I’m sorry I even bothered yall with this basic of an issue. Ugh! I need to get better at checking my syntax.
Sorry, second link was wrong. I don’t have my mouse at the coffee shop right now and copied it wrong. Here’s the correct link: http://i.imgur.com/0R2Jg7Xr.png
Looking at the documentation here it seems that maybe the problem is that I’m using get_field ?
https://www.advancedcustomfields.com/resources/get_field/
What’s the difference in output between get_field and the_field on a WYSIWYG field?
I also see that that there is the ability to call the field without formatting by saying get_field(‘field_name’, false, false). Am I understanding that correctly?
I was thinking like this:
having looked at the documentation here: https://www.advancedcustomfields.com/resources/textarea/
I think the thing I’m getting confused by is the difference between textarea and wysiwyg.
Here’s the problem:
I have a get_field php call inside of a p tag like this
<p class="class-name"> get_field(etc etc); </p>
And it outputs like this
<p class=class-name> </>
<p>
<ul>the content that I put into my field </ul>
<li>content</li>
<li>content</li>
<li>content</li>
<li>content</li>
</p>
<p> </p>
Which is super ugly and no good.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.