Hi,
I’m not really familiar with custom fields (just skimmed their docs), so I may be talking nonsense.
I see 3 ways to do something like that – Include a block like you did, include a shortcode, or call the PHP functions directly (see https://github.com/skaut/skaut-google-drive-gallery/blob/2.7.1/plugin/frontend/shortcode.php). Either way, you need to involve the PHP code in some way.
From what I read in the docs, custom fields aren’t really meant for this, right? (not saying you can’t use them, but you’d probably be scratching your left ear with your right hand…)
I’m afraid I can’t help any further as I don’t really understand this functionality of WP…
Marek
Hello Marek,
Thanks for answer.
Blocks or short code let the user locate the gallery anywhere in the post while I want the gallery to stay only at the bottom of the post, and only one gallery per post.
In the mean time I found a way with a couple of php lines in the content.php template, just after the_content();
as follows :
$folder_name = get_post_field('gdrive_folder_name');
$shortcode ='[sgdg path="'.$folder_name.'"]';
print 'My Gallery:'. apply_filters( 'the_content', $shortcode );
It works like a charm.
No need to enter the complete short code, only the folder name in the custom field.
If the user hasn’t knowlegde of the short code he will not use it,
and I disabled the block in the block manager.
So far so good!
Your idea of using google drive API+some kind of lightbox is very good for sites in low performance server (my case). Thanks for the work!
-
This reply was modified 1 year, 2 months ago by
g2lyon.
-
This reply was modified 1 year, 2 months ago by
g2lyon.
-
This reply was modified 1 year, 2 months ago by
g2lyon.
-
This reply was modified 1 year, 2 months ago by
g2lyon.
-
This reply was modified 1 year, 2 months ago by
g2lyon.
-
This reply was modified 1 year, 2 months ago by
g2lyon.
-
This reply was modified 1 year, 2 months ago by
g2lyon.
-
This reply was modified 1 year, 2 months ago by
g2lyon.
-
This reply was modified 1 year, 2 months ago by
g2lyon.
Glad you found a workaround that solves your issue!
Marek