dokdeleon
Forum Replies Created
-
Forum: Plugins
In reply to: [CMB2] Get custom meta box site options from multisitesresolved!
Forum: Plugins
In reply to: [CMB2] Get custom meta box site options from multisitesAmazing! Thank you Michael! I know you get this a lot but I really, really appreciate what you do here. Have a great weekend!
Forum: Plugins
In reply to: [CMB2] Get custom meta box site options from multisitesHi Michael,
The code i used to create the fields is the one from here: https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/options-and-settings-pages/theme-options-cmb.php
But i used my own prefix, instead of the myPrefix.
I also tested whether i can access the values of each site option from their respective sites. It works – i’m getting the colors… Let’s say I have site 1 (main site) that has test_color: red, site 2 : blue, site 3 : yellow. Outside the foreach loop, i’m getting the proper colors above. But when inside the foreach and the switch_to_blog, all i get is the color from the main/default site which is red. Sorry, I hope I’m making sense.
Edit: Just some more info – I am using underscore.me starter theme. I am accessing CMB2 directly from the folder and not through wp plugin manager. This code:
if ( file_exists( dirname( __FILE__ ) . '/cmb2/init.php' ) ) { require_once dirname( __FILE__ ) . '/cmb2/init.php'; } elseif ( file_exists( dirname( __FILE__ ) . '/CMB2/init.php' ) ) { require_once dirname( __FILE__ ) . '/CMB2/init.php'; }is being initiated on my functions.php file. And below that is the
require get_template_directory() . '/inc/myPrefix-options.php';Forum: Fixing WordPress
In reply to: contain every 5 posts inside divok, don’t bother… figured it out.
<?php $panel = 1;$countpost=1; ?> <div class="panel" id="<?php echo $panel; ?>"> <?php query_posts('category_name=category_name&showposts=-1'); ?> <?php while (have_posts()) : the_post(); ?> <!-- display whatever --> <?php if($countpost==5) {?> <!-- countpost = <?php echo $countpost; ?>--> </div> <!-- panel end <?php echo $panel; $panel++; ?>--> <div class="panel" id="<?php echo $panel; ?>"> <?php $countpost = 0; ?> <?php } else { ?> <!-- countpost = <?php echo $countpost; ?>--> <?php };$countpost++; endwhile;?> </div> <!-- panel end -->hope this can be useful to anyone