Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/* Create Shortcode for ACF Gallery || Example with Wordpress Gallery */ function acf_gallery_shortcode() { $images = get_field( 'gallery' ); $image_ids = array(); if ( $images ) { foreach ( $images as $image ) { array_push( $image_ids, $image['ID'] ); } // Generate string of ids ("123,456,789"). $images_string = implode( ',', $image_ids ); // Generate and do shortcode. // Note: The following string is split to simply prevent our own website from rendering the gallery shortcode. $shortcode = sprintf( '[' . 'gallery ids="%s"]', esc_attr( $images_string ) ); echo do_shortcode( $shortcode ); } } add_shortcode( 'gallery_acf', 'acf_gallery_shortcode' ); /* Shortcode Name, Functions Name || Use [gallery_acf] */
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)