Forum Replies Created
-
AuthorPosts
-
pwwwpwwwMemberif you look at the code that constructs the file upload meta box (\parts\fields\file.php), you find this at the top of it:
<?php $options = array_merge( array( 'button' =>'Add Media' ,'modal_title' =>'Add Media' ,'basic' => false ,'preview_size' => 'thumbnail' ,'textarea_rows' => 5 ,'save' => 'id' ) ,isset($options) && is_array($options) ? $options : array() ); ?>So I’m guessing you can do this:
`piklist(‘field’, array(
‘type’ => ‘file’
,’field’ => ‘upload_basic’
,’scope’ => ‘post_meta’
,’label’ => __(‘Add File(s)’,’piklist’)
,’description’ => __(‘This is the basic upload field.’,’piklist’)
,’options’ => array(
‘preview_size’ => ‘thumbnail’ //change this i.e ‘medium’, ‘large’, ‘full’ etc
)
));`Not tested, so let me know if it works
January 25, 2016 at 2:50 pm in reply to: Nested addmore repeater fields – aka page builder – displaying on the frontend #5735
pwwwpwwwMemberI think I figured it out. It’s a bit rough, but seems to handle the above example:
$pwww_builder = get_post_meta( get_the_ID(), 'module_group', true ); foreach ( $pwww_builder as $pwww_build ) { // Print out the first module type echo '<p>' . $pwww_build['module_editor'] . '</p>'; //The next module is an add-more field - lets dig a bit deeper $pwww_buildtitle = $pwww_build['module_title']; foreach ( $pwww_buildtitle as $pwww_title) { // Print out the second module type echo '<h2>' . $pwww_title . '</h2>'; } }I’ll have a go at creating my own page builder in the next day or two – I can think of at least 8-10 modules that would be useful for building those one-off landing pages that are normally a time drain. If you can leave this thread open for a few days, I’m sure I’ll be back with more questions / amateur code gibberish. I suspect my copypasta will fail miserably one I try and do fancier things.
January 25, 2016 at 1:05 pm in reply to: I need help creating reusable content blocks and showing them on the frontend #5731
pwwwpwwwMemberCheers Steve – just nested arrays to figure out now! You can go ahead and mark this as resolved (I’m sure I’ll fire-up another thread soon enough…)
January 25, 2016 at 11:32 am in reply to: I need help creating reusable content blocks and showing them on the frontend #5713
pwwwpwwwMemberWell, I’ve just about managed to get it working. My code needs cleaning up, but it’s a start:
global $post; $post_objects = get_post_meta($post->ID, 'attach_blocks'); if( $post_objects ): ?> <?php foreach( $post_objects as $post): // variable must be called $post ?> <?php setup_postdata($post); $blockstyle = get_post_meta($post, 'block_style', true); $blockimg = get_post_meta($post, 'content_block_img', true); ?> <section> <div class="<?php echo $blockstyle; ?>"> <h3><?php the_title(); ?></h3> <div><?php echo '<img src="' . wp_get_attachment_url($blockimg) . '" alt="" />';?></div> <?php the_content(); ?> </div> </section> <?php endforeach; ?> <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?> <?php endif; ?>January 21, 2016 at 2:45 pm in reply to: I need help creating reusable content blocks and showing them on the frontend #5686
pwwwpwwwMemberThis reply has been marked as private.January 15, 2016 at 5:43 pm in reply to: I need help creating reusable content blocks and showing them on the frontend #5635
pwwwpwwwMemberThis reply has been marked as private.January 15, 2016 at 4:05 pm in reply to: I need help creating reusable content blocks and showing them on the frontend #5632
pwwwpwwwMemberWell, after almost a day googling I’m still none the wiser.
And to add to my failure, I tried replicating the advanced add-more example in the docs without success. Considering I was just copying and pasting the example code, adjusted only for the template file paths, I have no idea why it wouldn’t work – only the days would print and not the workout schedule (reps, sets etc). I won’t even mention what happened when I tried outputting the Page Modules addmore demo in my theme 🙁
On that note, I think I’ll have to return to ACF. I appreciate it doesn’t store data very well, but the learning curve for non-devs feels less steep. Plus there’s plenty of example code floating around the web for pretty much everything I need to do.
Either way, thanks for trying to help. Maybe when I get my head around PHP I’ll give your plugin another go.
January 15, 2016 at 11:25 am in reply to: I need help creating reusable content blocks and showing them on the frontend #5628
pwwwpwwwMemberHmm, not sure that’ll work for what I’m trying to achieve. Your code example just pulls in the first entry of my attach_blocks field. I need to somehow loop through the attach_blocks data, i.e the list of content_blocks associated with the page, and then display their contents (title, post_content, block_img). Does this make sense?
January 15, 2016 at 11:12 am in reply to: Post to Post Relationships – Displaying a list of related posts in your theme #5627
pwwwpwwwMemberThanks for the reply Steve. As it turns out, the code I used above works just fine in the sidebar – no WP_Query or other wizardry needed. Not sure why it wouldn’t work the first 6 times I tried 🙂
-
AuthorPosts