wordpress post loop in javascript

<?php ob_start(); query_posts(array(‘post_type’ => ‘topnews’)); while (have_posts()) : the_post(); ?> { // the_title() can use a false to return the value for use with strip_tags (apparently) ‘title’ : ‘<?php echo stripslashes(the_title(false)); ?>’, // Where is this $desc coming from? ‘button_list’ : [ { ‘title’:’Demo’, ‘url’ : ‘http://bonchen.net/’ }, { ‘title’:’Download’, ‘url’:’http://porfolio.bonchen.net/’} ], ‘tags’ : [‘Portrait’] … Read more

Gutenberg block “This block appears to have been modified externally” on save

You are getting this error because your edit and save function output doesn’t match. save({attributes}) { return ( <button class=”usa-button”> { attributes.text } </button> ); } precisely, { attributes.text } is the save function is not being called or used in edit function. Either add attributes.text in edit function or remove that from save function. … Read more

Contact Form 7 – Give each checkbox a class?

with jquery in footer.php jQuery(document).ready(function($){ $(‘.wpcft-form-control div.checkbox’).addClass(‘col-4’); } or via css (you will have to adjust for various screen resolution and make some test) <style> .wpcft-form-control div.checkbox{width:33%;max-width:33%;float:left} </style> But I think you can create separate n separate checkboxes and wrap them in a <div class=”col-4″>[checkbox checkbox-x “option1″]</div> <div class=”col-4”>[checkbox checkbox-x “option2″]</div> <div class=”col-4”>[checkbox checkbox-x “option3”]</div> … Read more

How to hook CSS file according to theme selection in the customizer section

You can access Customizer values with get_theme_mod(), so you just need to check the value of your setting before enqueueing stylesheets the normal way: function wpse_310123_enqueue_scheme_css() { $scheme = get_theme_mod( ‘theme_scheme’ ); if ( $scheme === ‘green’ ) { wp_enqueue_style( ‘theme-green’, get_theme_file_uri( ‘green.css’ ) ); } elseif ( $scheme === ‘blue’) { wp_enqueue_style( ‘theme-blue’, get_theme_file_uri( … Read more