├── LICENSE.txt ├── README.md ├── README.txt ├── acf-page-builder.php ├── admin ├── acf-fields.json └── functions.php ├── composer.json ├── includes └── class.acf_page_builder.php ├── index.php ├── public ├── css │ └── acfpb_styles.css ├── functions.php └── js │ └── start.js └── uninstall.php /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Advanced Custom Fields Page Builder # 2 | 3 | **Contributors:** owenr88 4 | **Tags:** advanced custom fields, custom fields, page builder, build pages 5 | **Requires at least:** 3.8 6 | **Tested up to:** 4.6.1 7 | **Stable tag:** 1.1.4 8 | **License:** GPLv2 or later 9 | **License URI:** http://www.gnu.org/licenses/gpl-2.0.html 10 | 11 | A powerful and easy to use page builder, using the Advanced Custom Fields Flexible Content module. 12 | 13 | ## Description ## 14 | 15 | **PLEASE NOTE: The following plugins or add-ons are required for this to work:** 16 | 17 | * **[Advanced Custom Fields](http://www.advancedcustomfields.com/) is ESSENTIAL** 18 | * **The Advanced Custom Fields [Flexible Content add-on field](http://www.advancedcustomfields.com/add-ons/flexible-content-field/) is essential** 19 | * **[Simple Contact Forms](https://wordpress.org/plugins/simple-contact-forms/) is required for the Simple Contact Forms page builder section to work** 20 | 21 | The ACF Page Builder uses the Advanced Custom Fields Flexible Content field to create a bunch of completely customisable page elements. This plugin works best when used with [Bootstrap](http://getbootstrap.com/), but it isn't essential. These elements include: 22 | 23 | * Banner images 24 | * Buttons 25 | * Bootstrap Content Grids 26 | * Image Gallery (with text and caption) 27 | * Raw HTML and JavaScript 28 | * [Simple Contact Forms](https://wordpress.org/plugins/simple-contact-forms/) 29 | * WYSIWYG Content 30 | 31 | Each element can be configured - see the screenshots for configuration options. Default options are background colours, wrapper classes and if the element needs to be contained (Bootstrap only!) Please [get in touch](https://twitter.com/biglemontweets) or [submit pull requests](https://github.com/owenr88/acf-page-builder) for any more page sections. 32 | 33 | The ACF Page Builder was created and is managed by [Big Lemon Creative](http://www.biglemoncreative.co.uk). 34 | 35 | ### Configuration ### 36 | 37 | To configure which post types or page templates the page builder is displayed on, use the following filter in your functions.php file: 38 | 39 | ~~~~ 40 | function support_acfpb( $support = array() ) { 41 | 42 | $support['post_type'] = array( 43 | 'page', 44 | 'post' 45 | ); 46 | 47 | $support['page_template'] = array( 48 | 'page-templates/page-sectioned.php' 49 | ); 50 | 51 | return $support; 52 | 53 | } 54 | add_filter('acfpb_set_locations', 'support_acfpb', 10, 1); 55 | ~~~~ 56 | 57 | ### Usage ### 58 | 59 | We designed the functions to match the ACF syntax of `get_field()` and `the_field()`. Use the functions below to get or directly echo the sections on the front end. The ID is optional. 60 | 61 | `the_sections( $id );` 62 | 63 | OR 64 | 65 | `echo get_sections( $id );` 66 | 67 | ## Installation ## 68 | 69 | Install the plugin by following these steps: 70 | 71 | 1. Upload the `acf-page-builder` folder to the `/wp-content/plugins/` directory 72 | 2. Activate the plugin through the 'Plugins' menu in WordPress 73 | 3. Check out the settings page to create some fields and see how to include it in your theme 74 | 75 | The plugin can also be searched for and installed directly in the WordPress Plugin manager. 76 | 77 | Make sure that you have [Advanced Custom Fields](http://www.advancedcustomfields.com/) installed. 78 | 79 | ## Frequently Asked Questions ## 80 | 81 | Feel free to [contact us](http://www.biglemoncreative.co.uk) if you can't find an answer, or reach us on [Twitter](https://twitter.com/biglemontweets). 82 | 83 | ## Changelog ## 84 | 85 | ### v1.1.4 ### 86 | * Remove ID as an option to call the sections - doesn't work 87 | * The container is now disabled if Bootstrap is not selected 88 | * Tested up to 4.6.1 89 | 90 | ### v1.1.3 ### 91 | * Fixed the containment and bootstrap toggle - wasn't working! 92 | 93 | ### v1.1.2 ### 94 | * Changed contributors and some house keeping 95 | 96 | ### v1.1.1 ### 97 | * The very first version! Includes the following sections: banners, buttons, content grid, galleries, raw HTML, normal WYSIWYG text and simple contact form integration 98 | 99 | ## Upgrade Notice ## 100 | 101 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | === Advanced Custom Fields Page Builder === 2 | Contributors: owenr88 3 | Tags: advanced custom fields, custom fields, page builder, build pages 4 | Requires at least: 3.8 5 | Tested up to: 4.6.1 6 | Stable tag: 1.1.4 7 | License: GPLv2 or later 8 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 | 10 | A powerful and easy to use page builder, using the Advanced Custom Fields Flexible Content module. 11 | 12 | == Description == 13 | 14 | **PLEASE NOTE: The following plugins or add-ons are required for this to work:** 15 | 16 | * **[Advanced Custom Fields](http://www.advancedcustomfields.com/) is ESSENTIAL** 17 | * **The Advanced Custom Fields [Flexible Content add-on field](http://www.advancedcustomfields.com/add-ons/flexible-content-field/) is essential** 18 | * **[Simple Contact Forms](https://wordpress.org/plugins/simple-contact-forms/) is required for the Simple Contact Forms page builder section to work** 19 | 20 | The ACF Page Builder uses the Advanced Custom Fields Flexible Content field to create a bunch of completely customisable page elements. This plugin works best when used with [Bootstrap](http://getbootstrap.com/), but it isn't essential. These elements include: 21 | 22 | * Banner images 23 | * Buttons 24 | * Bootstrap Content Grids 25 | * Image Gallery (with text and caption) 26 | * Raw HTML and JavaScript 27 | * [Simple Contact Forms](https://wordpress.org/plugins/simple-contact-forms/) 28 | * WYSIWYG Content 29 | 30 | Each element can be configured - see the screenshots for configuration options. Default options are background colours, wrapper classes and if the element needs to be contained (Bootstrap only!) Please [get in touch](https://twitter.com/biglemontweets) or [submit pull requests](https://github.com/owenr88/acf-page-builder) for any more page sections. 31 | 32 | The ACF Page Builder was created and is managed by [Big Lemon Creative](http://www.biglemoncreative.co.uk). 33 | 34 | = Configuration = 35 | 36 | To configure which post types or page templates the page builder is displayed on, use the following filter in your functions.php file: 37 | 38 | ~~~~ 39 | function support_acfpb( $support = array() ) { 40 | 41 | $support['post_type'] = array( 42 | 'page', 43 | 'post' 44 | ); 45 | 46 | $support['page_template'] = array( 47 | 'page-templates/page-sectioned.php' 48 | ); 49 | 50 | return $support; 51 | 52 | } 53 | add_filter('acfpb_set_locations', 'support_acfpb', 10, 1); 54 | ~~~~ 55 | 56 | = Usage = 57 | 58 | We designed the functions to match the ACF syntax of `get_field()` and `the_field()`. Use the functions below to get or directly echo the sections on the front end. The ID is optional. 59 | 60 | `the_sections( $id );` 61 | 62 | OR 63 | 64 | `echo get_sections( $id );` 65 | 66 | == Installation == 67 | 68 | Install the plugin by following these steps: 69 | 70 | 1. Upload the `acf-page-builder` folder to the `/wp-content/plugins/` directory 71 | 2. Activate the plugin through the 'Plugins' menu in WordPress 72 | 3. Check out the settings page to create some fields and see how to include it in your theme 73 | 74 | The plugin can also be searched for and installed directly in the WordPress Plugin manager. 75 | 76 | Make sure that you have [Advanced Custom Fields](http://www.advancedcustomfields.com/) installed. 77 | 78 | == Frequently Asked Questions == 79 | 80 | = Can I ask you a question? = 81 | 82 | Yes. Head over to the [GitHub](https://github.com/owenr88/acf-page-builder) page with any questions or feature requests. You might also find your answer in the support tab. Feel free to [contact us](http://www.biglemoncreative.co.uk) if you can't find an answer, or reach us on [Twitter](https://twitter.com/biglemontweets). 83 | 84 | == Screenshots == 85 | 86 | 1. All sections collapsed 87 | 2. Banner section options 88 | 3. Button section options 89 | 4. Content Grid section options 90 | 5. Gallery section options 91 | 6. Raw HTML section options 92 | 7. Simple Contact Forms section options 93 | 8. WYSIWYG section options 94 | 9. Full Page of created sections 95 | 96 | == Changelog == 97 | 98 | = v1.1.4 = 99 | * Remove ID as an option to call the sections - doesn't work 100 | * The container is now disabled if Bootstrap is not selected 101 | * Tested up to 4.6.1 102 | 103 | = v1.1.3 = 104 | * Fixed the containment and bootstrap toggle - wasn't working! 105 | 106 | = v1.1.2 = 107 | * Changed contributors and some house keeping 108 | 109 | = v1.1.1 = 110 | * The very first version! Includes the following sections: banners, buttons, content grid, galleries, raw HTML, normal WYSIWYG text and simple contact form integration 111 | 112 | == Upgrade Notice == 113 | 114 | -------------------------------------------------------------------------------- /acf-page-builder.php: -------------------------------------------------------------------------------- 1 | This section uses Bootstrap<\/a> classes. We don't automatically include Bootstrap.<\/p>", 410 | "new_lines": "wpautop", 411 | "esc_html": 0 412 | }, 413 | { 414 | "key": "field_554909228473a", 415 | "label": "Background Colour", 416 | "name": "bg", 417 | "type": "color_picker", 418 | "instructions": "", 419 | "required": 0, 420 | "conditional_logic": 0, 421 | "wrapper": { 422 | "width": "", 423 | "class": "", 424 | "id": "" 425 | }, 426 | "default_value": "" 427 | }, 428 | { 429 | "key": "field_56c0b485864e0", 430 | "label": "Wrapper Class", 431 | "name": "wrapper_class", 432 | "type": "text", 433 | "instructions": "i.e. col-sm-4 col-sm-offset-4", 434 | "required": 0, 435 | "conditional_logic": 0, 436 | "wrapper": { 437 | "width": "", 438 | "class": "", 439 | "id": "" 440 | }, 441 | "default_value": "", 442 | "placeholder": "", 443 | "prepend": "", 444 | "append": "", 445 | "maxlength": "", 446 | "readonly": 0, 447 | "disabled": 0 448 | }, 449 | { 450 | "key": "field_5540bf1159b1e", 451 | "label": "Content Columns", 452 | "name": "content_columns", 453 | "type": "repeater", 454 | "instructions": "", 455 | "required": 0, 456 | "conditional_logic": 0, 457 | "wrapper": { 458 | "width": "", 459 | "class": "", 460 | "id": "" 461 | }, 462 | "collapsed": "", 463 | "min": 1, 464 | "max": 4, 465 | "layout": "table", 466 | "button_label": "Add Columns", 467 | "sub_fields": [ 468 | { 469 | "key": "field_5540c0bb59b1f", 470 | "label": "Content", 471 | "name": "content", 472 | "type": "wysiwyg", 473 | "instructions": "", 474 | "required": 0, 475 | "conditional_logic": 0, 476 | "wrapper": { 477 | "width": 70, 478 | "class": "", 479 | "id": "" 480 | }, 481 | "default_value": "", 482 | "tabs": "all", 483 | "toolbar": "full", 484 | "media_upload": 1 485 | }, 486 | { 487 | "key": "field_554a5878c9372", 488 | "label": "Width", 489 | "name": "width", 490 | "type": "number", 491 | "instructions": "", 492 | "required": 1, 493 | "conditional_logic": 0, 494 | "wrapper": { 495 | "width": 15, 496 | "class": "", 497 | "id": "" 498 | }, 499 | "default_value": 3, 500 | "placeholder": "", 501 | "prepend": "col-sm-", 502 | "append": "", 503 | "min": 1, 504 | "max": 12, 505 | "step": 1, 506 | "readonly": 0, 507 | "disabled": 0 508 | }, 509 | { 510 | "key": "field_554a57bbc9370", 511 | "label": "Offset", 512 | "name": "offset", 513 | "type": "number", 514 | "instructions": "", 515 | "required": 1, 516 | "conditional_logic": 0, 517 | "wrapper": { 518 | "width": 15, 519 | "class": "", 520 | "id": "" 521 | }, 522 | "default_value": "", 523 | "placeholder": "", 524 | "prepend": "col-sm-offset-", 525 | "append": "", 526 | "min": 0, 527 | "max": 12, 528 | "step": 1, 529 | "readonly": 0, 530 | "disabled": 0 531 | } 532 | ] 533 | } 534 | ], 535 | "min": "", 536 | "max": "" 537 | }, 538 | { 539 | "key": "553b90972ce3e", 540 | "name": "gallery", 541 | "label": "Gallery", 542 | "display": "row", 543 | "sub_fields": [ 544 | { 545 | "key": "field_553bd89149bd2", 546 | "label": "Background Colour", 547 | "name": "bg", 548 | "type": "color_picker", 549 | "instructions": "", 550 | "required": 0, 551 | "conditional_logic": 0, 552 | "wrapper": { 553 | "width": "", 554 | "class": "", 555 | "id": "" 556 | }, 557 | "default_value": "" 558 | }, 559 | { 560 | "key": "field_56c0eec031f65", 561 | "label": "Wrapper Class", 562 | "name": "wrapper_class", 563 | "type": "text", 564 | "instructions": "i.e. col-sm-4 col-sm-offset-4", 565 | "required": 0, 566 | "conditional_logic": 0, 567 | "wrapper": { 568 | "width": "", 569 | "class": "", 570 | "id": "" 571 | }, 572 | "default_value": "", 573 | "placeholder": "", 574 | "prepend": "", 575 | "append": "", 576 | "maxlength": "", 577 | "readonly": 0, 578 | "disabled": 0 579 | }, 580 | { 581 | "key": "field_56c0ef638f980", 582 | "label": "Images per Row", 583 | "name": "images_per_row", 584 | "type": "number", 585 | "instructions": "", 586 | "required": 0, 587 | "conditional_logic": 0, 588 | "wrapper": { 589 | "width": "", 590 | "class": "", 591 | "id": "" 592 | }, 593 | "default_value": 4, 594 | "placeholder": "", 595 | "prepend": "", 596 | "append": "", 597 | "min": 2, 598 | "max": 6, 599 | "step": "", 600 | "readonly": 0, 601 | "disabled": 0 602 | }, 603 | { 604 | "key": "field_553b90972ce3f", 605 | "label": "Images", 606 | "name": "images", 607 | "type": "repeater", 608 | "instructions": "", 609 | "required": 0, 610 | "conditional_logic": 0, 611 | "wrapper": { 612 | "width": "", 613 | "class": "", 614 | "id": "" 615 | }, 616 | "collapsed": "", 617 | "min": 1, 618 | "max": 8, 619 | "layout": "table", 620 | "button_label": "Add Image", 621 | "sub_fields": [ 622 | { 623 | "key": "field_553bd41f82d1e", 624 | "label": "Image", 625 | "name": "image", 626 | "type": "image", 627 | "instructions": "", 628 | "required": 1, 629 | "conditional_logic": 0, 630 | "wrapper": { 631 | "width": "", 632 | "class": "", 633 | "id": "" 634 | }, 635 | "return_format": "url", 636 | "preview_size": "thumbnail", 637 | "library": "all", 638 | "min_width": "", 639 | "min_height": "", 640 | "min_size": "", 641 | "max_width": "", 642 | "max_height": "", 643 | "max_size": "", 644 | "mime_types": "" 645 | }, 646 | { 647 | "key": "field_553bd45b82d1f", 648 | "label": "Title", 649 | "name": "title", 650 | "type": "text", 651 | "instructions": "", 652 | "required": 0, 653 | "conditional_logic": 0, 654 | "wrapper": { 655 | "width": "", 656 | "class": "", 657 | "id": "" 658 | }, 659 | "default_value": "", 660 | "placeholder": "", 661 | "prepend": "", 662 | "append": "", 663 | "maxlength": "", 664 | "readonly": 0, 665 | "disabled": 0 666 | }, 667 | { 668 | "key": "field_553bd48582d20", 669 | "label": "Caption", 670 | "name": "caption", 671 | "type": "text", 672 | "instructions": "", 673 | "required": 0, 674 | "conditional_logic": 0, 675 | "wrapper": { 676 | "width": "", 677 | "class": "", 678 | "id": "" 679 | }, 680 | "default_value": "", 681 | "placeholder": "", 682 | "prepend": "", 683 | "append": "", 684 | "maxlength": "", 685 | "readonly": 0, 686 | "disabled": 0 687 | } 688 | ] 689 | } 690 | ], 691 | "min": "", 692 | "max": "" 693 | }, 694 | { 695 | "key": "561538dcc6acb", 696 | "name": "raw_html", 697 | "label": "Raw HTML", 698 | "display": "row", 699 | "sub_fields": [ 700 | { 701 | "key": "field_56c0eb7227216", 702 | "label": "Background Colour", 703 | "name": "bg", 704 | "type": "color_picker", 705 | "instructions": "", 706 | "required": 0, 707 | "conditional_logic": 0, 708 | "wrapper": { 709 | "width": "", 710 | "class": "", 711 | "id": "" 712 | }, 713 | "default_value": "" 714 | }, 715 | { 716 | "key": "field_56c0eb9327217", 717 | "label": "Wrapper Class", 718 | "name": "wrapper_class", 719 | "type": "text", 720 | "instructions": "i.e. col-sm-4 col-sm-offset-4", 721 | "required": 0, 722 | "conditional_logic": 0, 723 | "wrapper": { 724 | "width": "", 725 | "class": "", 726 | "id": "" 727 | }, 728 | "default_value": "", 729 | "placeholder": "", 730 | "prepend": "", 731 | "append": "", 732 | "maxlength": "", 733 | "readonly": 0, 734 | "disabled": 0 735 | }, 736 | { 737 | "key": "field_561538e6c6acc", 738 | "label": "HTML", 739 | "name": "html", 740 | "type": "textarea", 741 | "instructions": "", 742 | "required": 0, 743 | "conditional_logic": 0, 744 | "wrapper": { 745 | "width": "", 746 | "class": "", 747 | "id": "" 748 | }, 749 | "default_value": "", 750 | "placeholder": "", 751 | "maxlength": "", 752 | "rows": "", 753 | "new_lines": "", 754 | "readonly": 0, 755 | "disabled": 0 756 | } 757 | ], 758 | "min": "", 759 | "max": "" 760 | }, 761 | { 762 | "key": "55acf045aca77", 763 | "name": "simple_contact_forms", 764 | "label": "Simple Contact Forms", 765 | "display": "row", 766 | "sub_fields": [ 767 | { 768 | "key": "field_56c0b02a6c79d", 769 | "label": "IMPORTANT", 770 | "name": "", 771 | "type": "message", 772 | "instructions": "", 773 | "required": 0, 774 | "conditional_logic": 0, 775 | "wrapper": { 776 | "width": "", 777 | "class": "", 778 | "id": "" 779 | }, 780 | "message": "

The Simple Contact Forms<\/a> plugin must be installed to use this section (Psst. It's really good!)<\/p>\r\n\r\n

These are only a few of the options available. View the main settings to configure Simple Contact Forms properly.<\/p>", 781 | "new_lines": "wpautop", 782 | "esc_html": 0 783 | }, 784 | { 785 | "key": "field_55acf3ebe375a", 786 | "label": "Background Colour", 787 | "name": "bg", 788 | "type": "color_picker", 789 | "instructions": "", 790 | "required": 0, 791 | "conditional_logic": 0, 792 | "wrapper": { 793 | "width": "", 794 | "class": "", 795 | "id": "" 796 | }, 797 | "default_value": "" 798 | }, 799 | { 800 | "key": "field_56c0b00f6c79c", 801 | "label": "Wrapper Class", 802 | "name": "wrapper_class", 803 | "type": "text", 804 | "instructions": "i.e. col-sm-4 col-sm-offset-4", 805 | "required": 0, 806 | "conditional_logic": 0, 807 | "wrapper": { 808 | "width": "", 809 | "class": "", 810 | "id": "" 811 | }, 812 | "default_value": "", 813 | "placeholder": "", 814 | "prepend": "", 815 | "append": "", 816 | "maxlength": "", 817 | "readonly": 0, 818 | "disabled": 0 819 | }, 820 | { 821 | "key": "field_55acf054aca78", 822 | "label": "Form Title", 823 | "name": "form_title", 824 | "type": "text", 825 | "instructions": "", 826 | "required": 0, 827 | "conditional_logic": 0, 828 | "wrapper": { 829 | "width": "", 830 | "class": "", 831 | "id": "" 832 | }, 833 | "default_value": "", 834 | "placeholder": "", 835 | "prepend": "", 836 | "append": "", 837 | "maxlength": "", 838 | "readonly": 0, 839 | "disabled": 0 840 | }, 841 | { 842 | "key": "field_55acf10baca79", 843 | "label": "Button", 844 | "name": "button", 845 | "type": "true_false", 846 | "instructions": "", 847 | "required": 0, 848 | "conditional_logic": 0, 849 | "wrapper": { 850 | "width": "", 851 | "class": "", 852 | "id": "" 853 | }, 854 | "message": "Hide form with button?", 855 | "default_value": 0 856 | }, 857 | { 858 | "key": "field_55acf18eaca7b", 859 | "label": "Button Text", 860 | "name": "btn_text", 861 | "type": "text", 862 | "instructions": "", 863 | "required": 0, 864 | "conditional_logic": [ 865 | [ 866 | { 867 | "field": "field_55acf10baca79", 868 | "operator": "==", 869 | "value": "1" 870 | } 871 | ] 872 | ], 873 | "wrapper": { 874 | "width": "", 875 | "class": "", 876 | "id": "" 877 | }, 878 | "default_value": "", 879 | "placeholder": "", 880 | "prepend": "", 881 | "append": "", 882 | "maxlength": "", 883 | "readonly": 0, 884 | "disabled": 0 885 | }, 886 | { 887 | "key": "field_55acf128aca7a", 888 | "label": "Email Subject Field", 889 | "name": "email_subject", 890 | "type": "text", 891 | "instructions": "", 892 | "required": 0, 893 | "conditional_logic": 0, 894 | "wrapper": { 895 | "width": "", 896 | "class": "", 897 | "id": "" 898 | }, 899 | "default_value": "", 900 | "placeholder": "", 901 | "prepend": "", 902 | "append": "", 903 | "maxlength": "", 904 | "readonly": 0, 905 | "disabled": 0 906 | } 907 | ], 908 | "min": "", 909 | "max": "" 910 | }, 911 | { 912 | "key": "553b8cd6dbe66", 913 | "name": "wysiwyg", 914 | "label": "WYSIWYG", 915 | "display": "block", 916 | "sub_fields": [ 917 | { 918 | "key": "field_553bc590fbc55", 919 | "label": "Background Colour", 920 | "name": "bg", 921 | "type": "color_picker", 922 | "instructions": "", 923 | "required": 0, 924 | "conditional_logic": 0, 925 | "wrapper": { 926 | "width": "", 927 | "class": "", 928 | "id": "" 929 | }, 930 | "default_value": "" 931 | }, 932 | { 933 | "key": "field_56c0ac2ac7847", 934 | "label": "Wrapper Class", 935 | "name": "wrapper_class", 936 | "type": "text", 937 | "instructions": "i.e. col-sm-4 col-sm-offset-4", 938 | "required": 0, 939 | "conditional_logic": 0, 940 | "wrapper": { 941 | "width": "", 942 | "class": "", 943 | "id": "" 944 | }, 945 | "default_value": "", 946 | "placeholder": "", 947 | "prepend": "", 948 | "append": "", 949 | "maxlength": "", 950 | "readonly": 0, 951 | "disabled": 0 952 | }, 953 | { 954 | "key": "field_553b8ce8c8c3c", 955 | "label": "Content", 956 | "name": "content", 957 | "type": "wysiwyg", 958 | "instructions": "", 959 | "required": 0, 960 | "conditional_logic": 0, 961 | "wrapper": { 962 | "width": "", 963 | "class": "", 964 | "id": "" 965 | }, 966 | "default_value": "", 967 | "tabs": "all", 968 | "toolbar": "full", 969 | "media_upload": 1 970 | } 971 | ], 972 | "min": "", 973 | "max": "" 974 | } 975 | ] 976 | } 977 | ], 978 | "location": [ 979 | [ 980 | { 981 | "param": "post_type", 982 | "operator": "==", 983 | "value": "post" 984 | } 985 | ], 986 | [ 987 | { 988 | "param": "page_template", 989 | "operator": "==", 990 | "value": "page-templates\/full-width.php" 991 | } 992 | ] 993 | ], 994 | "menu_order": 0, 995 | "position": "normal", 996 | "style": "default", 997 | "label_placement": "top", 998 | "instruction_placement": "label", 999 | "hide_on_screen": [ 1000 | "the_content" 1001 | ], 1002 | "active": 1, 1003 | "description": "" 1004 | } 1005 | ] -------------------------------------------------------------------------------- /admin/functions.php: -------------------------------------------------------------------------------- 1 | addFieldsToWP(); 16 | 17 | } 18 | add_action( 'after_setup_theme', 'acfpg_init_admin' ); 19 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "owenr88/acf-page-builder", 3 | "description": "A powerful and easy to use page builder, using the Advanced Custom Fields Flexible Content module. WordPress plugin.", 4 | "keywords": ["advanced custom fields","custom fields","acf", "page builder", "build pages", "wordpress", "plugin"], 5 | "authors": [ 6 | { 7 | "name": "Owen Richards", 8 | "email": "owen@biglemoncreative.co.uk", 9 | "homepage": "http://www.biglemoncreative.co.uk", 10 | "role": "Technical Director" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.3.0" 15 | } 16 | } -------------------------------------------------------------------------------- /includes/class.acf_page_builder.php: -------------------------------------------------------------------------------- 1 | acf_active = is_plugin_active( 'advanced-custom-fields/acf.php' ) || is_plugin_active( 'advanced-custom-fields-pro/acf.php' ); 49 | 50 | $this->scf_active = is_plugin_active( 'simple-contact-forms/simple-contact-forms.php' ); 51 | 52 | $this->supported_formats = array('post_type', 'page_template'); 53 | 54 | $this->use_bs = function_exists('get_field') ? get_field('acfpb_use_bootstrap') : false; 55 | 56 | } 57 | 58 | 59 | /** 60 | * Enqueue the styles and scripts for the public 61 | */ 62 | public function enqueuePublic() { 63 | 64 | wp_enqueue_style( 'acfpb-public', plugin_dir_url( __FILE__ ) . '../public/css/acfpb_styles.css', false, NULL, 'all' ); 65 | 66 | } 67 | 68 | 69 | /** 70 | * Enqueue the styles and scripts for the admin 71 | */ 72 | public function enqueueAdmin() { 73 | 74 | 75 | 76 | } 77 | 78 | 79 | /** 80 | * Retrieves all the section HTML 81 | * @param String $name The slug used for the sections. Is 'sections' by default 82 | * @return String The final HTML 83 | */ 84 | public function getSectionsHTML( $name, $post_id ) { 85 | 86 | if( !$this->acf_active ) return ''; 87 | 88 | if( have_rows( $name, $post_id ) ): 89 | 90 | $s = 1; 91 | 92 | $this->html = '

'; // Main Wrapper finish 139 | 140 | return $this->html; 141 | 142 | else : 143 | 144 | return ''; 145 | 146 | endif; 147 | 148 | } 149 | 150 | 151 | /** 152 | * Admin function to add the fields to wordpress. Also figures out where to show them based on the acfs_add_support and acfs_remove_support functions 153 | */ 154 | public function addFieldsToWP() { 155 | 156 | if( !$this->acf_active ) return false; 157 | 158 | if( function_exists('acf_add_local_field_group') ) { 159 | 160 | // Get the exported field data 161 | 162 | $json = file_get_contents( plugin_dir_path(__FILE__) . '../admin/acf-fields.json' ); 163 | 164 | $json_to_php = json_decode( $json, true ); 165 | 166 | $acf_fields_array = $json_to_php[0]['fields']; 167 | 168 | // Check if SCF is included or leave it out of the list of fields if not 169 | 170 | if( !$this->scf_active ) { 171 | 172 | foreach ($acf_fields_array[1]['layouts'] as $key => $data) { 173 | 174 | if( $data['name'] === 'simple_contact_forms' ) { 175 | 176 | unset( $acf_fields_array[1]['layouts'][$key] ); 177 | 178 | break; 179 | 180 | } 181 | 182 | } 183 | 184 | } 185 | 186 | // Create the rest of the field group 187 | 188 | $meta = array( 189 | 'key' => 'group_553b8b2752aba_pb10192283', 190 | 'title' => 'Page Builder', 191 | 'fields' => $acf_fields_array, 192 | 'menu_order' => 10, 193 | 'position' => 'normal', 194 | 'style' => 'default', 195 | 'label_placement' => 'top', 196 | 'instruction_placement' => 'label', 197 | 'hide_on_screen' => array (), 198 | 'location' => array(), 199 | 'active' => 1, 200 | 'description' => '', 201 | ); 202 | 203 | // Filter to get the locations 204 | 205 | $location = apply_filters( 'acfpb_set_locations', array() ); 206 | 207 | $l = 0; 208 | 209 | foreach ($this->supported_formats as $format) { 210 | 211 | if( !isset($location[$format]) || empty($location[$format]) ) continue; 212 | 213 | $meta['location'][$l] = array(); 214 | 215 | foreach ($location[$format] as $place) { 216 | 217 | $meta['location'][$l][] = array( 218 | 'param' => $format, 219 | 'operator' => '==', 220 | 'value' => $place, 221 | ); 222 | 223 | $l++; 224 | 225 | } 226 | 227 | } 228 | 229 | acf_add_local_field_group($meta); 230 | 231 | } 232 | 233 | } 234 | 235 | 236 | /** 237 | * Get the Banner section. 238 | * @return String Final string of this section 239 | */ 240 | private function getSection_banner() { 241 | 242 | $class = $this->use_bs ? 'img-responsive' : ''; 243 | 244 | $html = ''; 251 | 252 | return $html; 253 | 254 | } 255 | 256 | 257 | /** 258 | * Get the button section. 259 | * @return String Final string of this section 260 | */ 261 | private function getSection_button() { 262 | 263 | $class = get_sub_field('button_class'); 264 | 265 | $text = get_sub_field('button_text'); 266 | 267 | switch ( get_sub_field('link_to_page') ) { 268 | 269 | case 'anchor': 270 | $href = '#' . get_sub_field('button_anchor'); 271 | break; 272 | 273 | case 'external': 274 | $href = get_sub_field('external_link'); 275 | break; 276 | 277 | case 'internal': 278 | $href = get_sub_field('internal_link'); 279 | break; 280 | 281 | default: 282 | $href = '#'; 283 | break; 284 | 285 | } 286 | 287 | $html = '' . $text . ''; 288 | 289 | return $html; 290 | 291 | } 292 | 293 | 294 | /** 295 | * Get the Content Grid section. 296 | * @return String Final string of this section 297 | */ 298 | private function getSection_content_grid() { 299 | 300 | $blocks = get_sub_field('content_columns'); 301 | 302 | $html = ''; 303 | 304 | if( count($blocks) > 0 ) : 305 | 306 | foreach($blocks as $block) { 307 | 308 | $html .= '
'; 309 | 310 | $html .= $block['content']; 311 | 312 | $html .= '
'; 313 | 314 | }; 315 | 316 | endif; 317 | 318 | return $html; 319 | 320 | } 321 | 322 | 323 | /** 324 | * Get the Gallery section. 325 | * @return String Final string of this section 326 | */ 327 | private function getSection_gallery() { 328 | 329 | $images = get_sub_field('images'); 330 | 331 | $html = ''; 332 | 333 | switch ( get_sub_field('images_per_row') ) { 334 | 335 | case '2': 336 | $first_class = 'col-sm-offset-2'; 337 | $class = 'col-sm-4'; 338 | break; 339 | 340 | case '3': 341 | $first_class = ''; 342 | $class = 'col-sm-4'; 343 | break; 344 | 345 | case '5': 346 | $first_class = 'col-sm-offset-1'; 347 | $class = 'col-sm-2'; 348 | break; 349 | 350 | case '6': 351 | $first_class = ''; 352 | $class = 'col-sm-2'; 353 | break; 354 | 355 | default: 356 | $first_class = ''; 357 | $class = 'col-sm-3'; 358 | break; 359 | } 360 | 361 | if( count($images) > 0 ) : 362 | 363 | $i = 1; 364 | 365 | foreach($images as $item) { 366 | 367 | if( $i === 1 ) $class .= ' ' . $first_class; 368 | 369 | $html .= '
'; 370 | 371 | $html .= ''; 372 | 373 | if( $item['title'] !== '' ) $html .= '

' . $item['title'] . '

'; 374 | 375 | if( $item['caption'] !== '' ) $html .= '

' . $item['caption'] . '

'; 376 | 377 | $html .= '
'; 378 | 379 | $i++; 380 | 381 | }; 382 | 383 | endif; 384 | 385 | return $html; 386 | 387 | } 388 | 389 | 390 | /** 391 | * Get the Raw HTML section. 392 | * @return String Final string of this section 393 | */ 394 | private function getSection_raw_html() { 395 | 396 | $html = get_sub_field('html'); 397 | 398 | return $html; 399 | 400 | } 401 | 402 | 403 | /** 404 | * Get the Simple Contact Forms section. 405 | * @return String Final string of this section 406 | */ 407 | private function getSection_simple_contact_forms() { 408 | 409 | if( !function_exists('simple_contact_form') ) return ''; 410 | 411 | $options = array(); 412 | 413 | if( get_sub_field('form_title') !== '' ) $options['form_title'] = get_sub_field('form_title'); 414 | 415 | if( get_sub_field('button') == true ) { 416 | 417 | $options['button'] = true; 418 | $options['form_collapsed'] = true; 419 | 420 | if( get_sub_field('btn_text') !== '' ) $options['btn_text'] = get_sub_field('btn_text'); 421 | 422 | } 423 | 424 | if( get_sub_field('email_subject') !== '' ) $options['email_subject'] = get_sub_field('email_subject'); 425 | 426 | $options['return'] = true; 427 | 428 | $html = simple_contact_form( $options ); 429 | 430 | return $html; 431 | 432 | } 433 | 434 | 435 | /** 436 | * Get the WYSIWYG section. 437 | * @return String Final string of this section 438 | */ 439 | private function getSection_wysiwyg() { 440 | 441 | $html = get_sub_field('content'); 442 | 443 | return $html; 444 | 445 | } 446 | 447 | 448 | } -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | ID; 14 | 15 | if( !$id ) return false; 16 | 17 | $pb = new ACF_Page_Builder(); 18 | 19 | $pb->addFieldsToWP(); 20 | 21 | $html = $pb->getSectionsHTML( 'acf_page_builder', (string) $id ); 22 | 23 | return isset($html) ? $html : ''; 24 | 25 | } 26 | 27 | 28 | 29 | /** 30 | * Output all the sections HTML to output to the page 31 | * @param String $id This post or page's ID 32 | */ 33 | function the_sections( $id = '' ) { 34 | 35 | $html = get_sections( $id ); 36 | 37 | echo $html; 38 | 39 | } 40 | 41 | 42 | /** 43 | * Initiate the public side 44 | */ 45 | function acfpg_init_public() { 46 | 47 | if( is_admin() ) return false; 48 | 49 | $pb = new ACF_Page_Builder(); 50 | 51 | add_action('wp_enqueue_scripts', array( $pb, 'enqueuePublic') ); 52 | 53 | } 54 | add_action( 'after_setup_theme', 'acfpg_init_public' ); 55 | -------------------------------------------------------------------------------- /public/js/start.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | }); -------------------------------------------------------------------------------- /uninstall.php: -------------------------------------------------------------------------------- 1 |