SQL error 1677 cannot be converted from type ‘datetime’ to type ‘varchar(255)’

I got error 1677 on my slave.

Last_Errno: 1677 Last_Error: Column 25 of table 'db.table' cannot be converted from type 'datetime' to type 'varchar(255)' 

I’m try to solved this by copy the same db from master to the slave, but after I restart the slave it still showing the same error. I’ve done too walk around to find the solution. one of them are set slave_type_conversions=all_non_lossy but, I didnt sure to take this because it running well before.

running show create table db.table\G on both master and duplicate showing same output without any different.

There is anything I can do with this?

how to display image in custom post type from frontend form using advanced custom field?

here is my code: employeedetails.php

<div class="container submit-message">     <h1>Employee Form</h1>     <form id="enquiry_email_form" action="#" method="POST" data-url="<?php echo admin_url('admin-ajax.php'); ?>" enctype="multipart/form-data">     <div class="form-group">             <label for="">Enter Title</label>             <input type="text" class="form-control" name="title" id="title"/>         </div>         <div class="form-group">             <label for="">Enter Description</label>             <input type="text" class="form-control" name="description" id="description"/>         </div>         <div class="form-group">             <label for="">Enter Your Name</label>             <input type="text" class="form-control" name="post_name" id="post_name"/>         </div>         <div class="form-group">             <label for="">Enter Your Designation</label>             <input type="text" name="post_designation" id="post_designation" class="form-control"/>         </div>         <div class="form-group">             <label for="">Salary</label>             <input type="text" class="form-control" name="post_salary" id="post_salary"/>         </div>         <div class="form-group">             <label for="">Enter Joining Date</label>             <input type="date" class="form-control" name="post_date" value="<?php echo date('Y-m-d'); ?>" id="post_date"/>         </div>            <div class="form-group">             <label for="">Select Image</label>             <input type="file" id="post_img" name="post_img" src="<?php bloginfo('template_url'); ?>" value="" accept="image/*""/>         </div>         <div class="form-group">             <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-pencil"></i> Submit</button>         </div>     </form> </div> 

$ (document).ready(function() { $ (“#enquiry_email_form”).on(“submit”,function(event){ event.preventDefault(); /* Clear result div $ (“#data”).html(”); */ var form= $ (this); var ajaxurl = form.data(“”); // var image = $ (‘#post_img’).prop(‘files’)[0]; var post_title = form.find(“#title”).val(); var post_description = form.find(“#description”).val(); var post_name = form.find(“#post_name”).val(); var post_designation = form.find(“#post_designation”).val(); var post_salary = form.find(“#post_salary”).val(); var post_date = form.find(“#post_date”).val(); var post_img = form.find(“#post_img”).val(); /*console.log(post_title); console.log(post_description); console.log(post_name); console.log(post_designation); console.log(post_salary); console.log(post_date); console.log(post_img);*/ /*if(detail_info.post_title === “” || detail_info.post_description === “” || detail_info.post_designation === “” || detail_info.post_salary === “” || detail_info.post_date === “” || detail_info.post_img === “”) { alert(“Fields cannot be blank”); return; }*/ $ (“.btn btn-primary”).text(‘submitting…’); $ .ajax({ url: “/wp-admin/admin-ajax.php”, type: ‘POST’, data: { action: ‘save_post_details_form_employee’, // this is going to be used inside wordpress functions.php post_title : post_title, post_description : post_description, post_name : post_name, post_designation : post_designation, post_salary : post_salary, post_date : post_date, post_img : post_img }, success: function(data) { //alert(“Insert Success”); //console.log(data); // Show successfully for submit message $ (“.submit-message”).html(‘Thank you for submitting’); } }); }); });

Custom post type paging return home page

I am having problem with Custom post type paging. Clicking on 2nd page of paging through back to home page. Permalinks flush/refreshed and i am using simple code to show custom post.

following is my code

$  cpt_type =  get_the_title(); $  paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $  custom_terms = get_terms('types'); $  args = array('posts_per_page' => 4, 'post_type' => $  cpt_type, 'paged' => $  paged, 'order', 'desc'/*, 'tax_query' => array( array('taxonomy' => 'type', 'field' => 'slug', 'terms' => $  custom_term->slug ))*/); $  customPostQuery = new WP_Query($  args); if($  customPostQuery->have_posts() ):     while($  customPostQuery->have_posts()) : $  customPostQuery->the_post();         global $  post;  <h4>Terms: <?php $  custom_term->name; ?></h4> <h3 class ="cq-h3"><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a> <p><?php echo the_content(); ?></p>  endwhile;     function cpt_pagination($  pages = '', $  range = 4){         $  showitems = ($  range * 2)+1;         global $  paged;         if(empty($  paged)) $  paged = 1;         if($  pages == ''){             global $  wp_query;             $  pages = $  wp_query->max_num_pages;             if(!$  pages){                 $  pages = 1;             }         }         if(1 != $  pages){             echo "<nav aria-label='Page navigation example'>  <ul class='pagination'> <span>Page ".$  paged." of ".$  pages."</span>";             if($  paged > 2 && $  paged > $  range+1 && $  showitems < $  pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";             if($  paged > 1 && $  showitems < $  pages) echo "<a href='".get_pagenum_link($  paged - 1)."'>&lsaquo; Previous</a>";             for ($  i=1; $  i <= $  pages; $  i++){                 if (1 != $  pages &&( !($  i >= $  paged+$  range+1 || $  i <= $  paged-$  range-1) || $  pages <= $  showitems )){                     echo ($  paged == $  i)? "<li class=\"page-item active\"><a class='page-link'>".$  i."</a></li>":"<li class='page-item'> <a href='".get_pagenum_link($  i)."' class=\"page-link\">".$  i."</a></li>";                 }             }             if ($  paged < $  pages && $  showitems < $  pages) echo " <li class='page-item'><a class='page-link' href=\"".get_pagenum_link($  paged + 1)."\">i class='flaticon flaticon-back'></i></a></li>";             if ($  paged < $  pages-1 &&  $  paged+$  range-1 < $  pages && $  showitems < $  pages) echo " <li class='page-item'><a class='page-link' href='".get_pagenum_link($  pages)."'><i class='flaticon flaticon-arrow'></i></a></li>";             echo "</ul></nav>\n";         }     }     if (function_exists("cpt_pagination")) {         cpt_pagination($  customPostQuery->max_num_pages);     } 

kindly correct me where i’ve placed wrong code. my cpt is ‘lectures’

Add link to excerpt if is on search and is custom post type

I want to display the excerpt and add a link to the bottom if the searched result if from my custom post type. What filter should I use?

if ( is_search() && get_post_type() == 'books' ) {          function exceprt_link( $  search_excerpt ) {         $  added_link = "<br><a href='https://google.com'>Go to google</a>";                  $  new_excerpt = $  search_excerpt . $  added_link;                  return $  new_excerpt;              }     add_filter( 'the_excerpt', 'exceprt_link' );      }  

Msg 8114, Level 16 , State 5, Line 1 Error converting data type nvarchar to float error

Just having some issue when trying to combine table using the union function keep getting this error as above

Msg 8114, Level 16 , State 5, Line 1
Error converting data type nvarchar to float error

SELECT * FROM dbo.['202004-divvy-tripdata$  '] UNION ALL  SELECT * FROM dbo.['202005-divvy-tripdata$  '] UNION All SELECT * FROM dbo.['202006-divvy-tripdata$  '] UNION all  SELECT * FROM dbo.['202007-divvy-tripdata$  '] UNION all SELECT * FROM dbo.['202008-divvy-tripdata$  '] UNION all SELECT * FROM dbo.['202009-divvy-tripdata$  '] UNION ALL SELECT * FROM dbo.['202010-divvy-tripdata$  '] UNION ALL SELECT * FROM dbo.['202011-divvy-tripdata$  '] (UNION ALL SELECT * FROM dbo.['202012-divvy-tripdata$  ']) -----> here is where it stops working and I get an error message as shown above.  

Can I get help on this?

Submit a form and save data to custom post type in woocommerce

I am wondering how can I send the data submit in WS FORM to a tab in WooCommerce Frontend Manager the tab have his own php but the site is multivendor.

wsform gave this action config im triyng using Push to Custom Endpoint: http://localhost/vendor/tabpage.php and requested method:post

<?php 

$ vendor_id = $ store_user->get_id(); $ $ wcfm_modified_endpoints= get_user_meta( $ vendor_id, ‘wcfm_endpoints’, true ); ?>

echo do_shortcode( ‘[wcfm_store_info data="ws_form id="2"]’ );

Rerender core Templates with with ToggleControl but it doesnt recognize block type

Hey Guys I want to change my const TEMPLATE = [template] dynamically with the <InnerBlocks template={TEMPLATE} /> component. Based on a toggle I want to remove my ‘core/image’ block. I tried to create this with state and I set the state of my template and columns when I toggle them. Gutenberg gives a blocktype ‘r’ not recognized error.

My index.js file of the block can be found in here

const { __ } = wp.i18n; import './styles/editor.scss' import './styles/style.scss' import edit from './edit'; import save from './save';  /**  * Register block  */  export const name = 'toolbox/three-cta';  export const settings = {     title: __("Three CTA Block"),     description: __("Display CTA block"),     category: "widget",     icon: "awards",     attributes: {         paragraph: {             type: 'string',             default: '',             source: 'html',             selector: 'p'         },         heading: {             type: 'string',             source: 'html',             selector: 'h2'         },         cards: {             type: 'number',             default: 0,         },         toggleImg: {             type: 'boolean',             default: false,         }     },     edit,     save, }  

And in edit.js these attributes gets changed. I think it has something to do with the core blocks I might be setting. But I didnt change the names of these core blocks, so I dont understand why Gutenberg doesnt recognize it.

import { InnerBlocks, InspectorControls } from "@wordpress/block-editor"; import { __ } from "@wordpress/i18n"; import { PanelBody, PanelRow, RangeControl, ToggleControl } from "@wordpress/components"; import { useDispatch, useSelect } from "@wordpress/data"; import { createBlock } from "@wordpress/blocks"; import { useState } from "@wordpress/element"; const { times } = lodash;   // const TEMPLATE = [ // The template that should be reproduced. Based on the toggle  [ "core/image", {} ], should be removed //  [ 'core/heading', { placeholder: 'Three CTA Block' } ], //  [ 'core/columns', {}, [ //      [ 'core/column', {}, [ //          [ "core/image", {} ], //          [ "core/heading", { placeholder: __( "Toolbox CTA" ) } ], //          [ "core/paragraph", { placeholder: "CTA Description" } ], //          [ "core/button", { placeholder: "Call to Action" } ], //      ] //      ], //      [ 'core/column', {}, [ //          [ "core/image", {} ], //          [ "core/heading", { placeholder: __( "Toolbox CTA" ) } ], //          [ "core/paragraph", { placeholder: "CTA Description" } ], //          [ "core/button", { placeholder: "Call to Action" } ], //      ] //      ], //      [ 'core/column', {}, [ //          [ "core/image", {} ], //          [ "core/heading", { placeholder: __( "Toolbox CTA" ) } ], //          [ "core/paragraph", { placeholder: "CTA Description" } ], //          [ "core/button", { placeholder: "Call to Action" } ] //      ] //      ], //  ] //  ] ];  export default function edit( props ) {     const { className, attributes, setAttributes, clientId } = props;      // code for the rangeControl Innerblocks doesnt affect the code (if not clicked on the rangeControls)     const { replaceInnerBlocks } = useDispatch( "core/block-editor" );     let { inner_blocks } = useSelect( select => ( {         inner_blocks: select( "core/block-editor" ).getBlocks( clientId )     } ) );      let [column, setColumn] = useState([ 'core/column', {}, [         [ "core/heading", { placeholder: __( "PLACEHOLDER" ) } ],         [ "core/paragraph", { placeholder: "CTA P" } ],         [ "core/button", { placeholder: "CTA Button" } ],     ]])       const [template, setTemplate] = useState([         ["core/heading", { placeholder: "Three CTA Block" }],         ["core/columns", {}, [...column]],     ])        const toggleChange = (value) => {         setAttributes({ toggleImg: value })         // const newColumn = column += ['core/column', {}, [["core/image", {}],]];         const newColumn = [ 'core/column', {}, [             [ "core/image", {} ],             [ "core/heading", { placeholder: __( "Toolbox CTA" ) } ],             [ "core/paragraph", { placeholder: "CTA Description" } ],             [ "core/button", { placeholder: "Call to Action" } ],         ]]          setColumn(newColumn);         setTemplate([             ["core/heading", { placeholder: "Three CTA Block" }],             ["core/columns", {}, [...newColumn]],         ])      }      const getInspector = () => {         return (                 <InspectorControls>                     <PanelBody                             title="Add columns"                             initalOpen={true}                     >                         <PanelRow>                             <RangeControl                                     label="columns"                                     value={attributes.cards}                                     min={0}                                     max={3}                                     onChange={count => {                                         let new_innerblocks = inner_blocks                                         if ( attributes.cards < count ) {                                             new_innerblocks = [                                                 ...inner_blocks,                                                 ...times( count - attributes.cards, () =>                                                         createBlock( "toolbox/three-cta" )                                                 )                                             ];                                         } else if ( attributes.cards > count ) {                                             inner_blocks = inner_blocks.slice( 0, count )                                         }                                         replaceInnerBlocks( clientId, new_innerblocks, false );                                     }}                             />                         </PanelRow>                         <PanelRow>                             <ToggleControl                                     label="Toggle me"                                     checked={attributes.toggleImg}                                     onChange={(value) => toggleChange(value)}                             />                         </PanelRow>                     </PanelBody>                 </InspectorControls>         )     }      return (             <>                 {getInspector()}                 <div className={className}>                     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/css/foundation.min.css" integrity="sha256-ogmFxjqiTMnZhxCqVmcqTvjfe1Y/ec4WaRj/aQPvn+I=" crossOrigin="anonymous"/>                     <div className="grid-x">                         <div className="cell small-12">                             <InnerBlocks template={template} templateLock="true"/>                         </div>                     </div>                 </div>             </>     ); } 

Rewrite custom post type URL in search

I have a website in which I have a custom post type (guest authors from CoAuthors Plus). With a plugin I managed to make post of custom type "guest author" searchable by WordPress legacy search.

Now, the authors are correctly shown in search results. Although, they are linked to a wrong page, /?post_type=guest-author&p=2148, which brings to a 404.

I’d like to be able to get the URL, interprete it, and redirect to the correct page (which is in the form of /archives/author/name-surname/.

I’m trying to get it working with a rewrite URL, but I’m not able to catch the data and formulate the rewrite.

How to get all post categories without custom post type categories?

0

I am creating a Blog in wordpress.

I have a list of categories: Technology, Art, fashion, Home, Lifetime, Education, Business, Religion, Design and home, Marketing

In which some of these categories I am using only in Custom Post Type (Technology, Art, Fashion) and others only in Normal Posts (Home, Life, Education, Business, Religion, Design and home, Marketing).

When I created the custom pos type, I used the CPT UI plugin.

Now I need to get the list of categories that are only being used from normal posts to show them on my blog (). I tried to do the following but it returns all categories including CPTs:

$  categories = get_categories();   foreach($  categories as $  category) {     echo '<li class="cat-name"  . '>' . $  category->name . '</li>'; } 

I just need to show the categories: Home, Life, Education, Business, Religion, Design & Home, Marketing.

And exclude those that are being used in CPT. Please Help!

Creating post template for a Custom Post Type

I have a custom post type called ‘abstract’ which contains the following meta_input array items

 $  abstract_details = array(  'post_title' => $  result->title, meta_input' => array(                 'abstract_id' => $  result->abstract_id,                 'title' => $  result->title,                 'author' => $  result->author,                 'writeup' => $  result->writeup,                 'ref' => $  result->ref,             ),             'post_type'   => 'abstract',             'post_status' => 'publish',         ); 

I want to display the contents of these items into their respective post, using something similar to below

<li style="list-style-type: none; text-align: justify;"><?php echo nl2br(esc_html(get_post_meta(get_the_ID(), 'writeup', true))) ?></li>                     <br>                     <?php $  isAvailRef = get_post_meta(get_the_ID(), 'ref', true)?>                     <?php $  refTag = "References/Bibliography: "?>                     <li style="list-style-type: none;"><b><?php if(!empty($  isAvailRef)): echo $  refTag; endif;?></b></li>                     <li style="list-style-type: none;"><?php echo nl2br(esc_html($  isAvailRef))?></li>                     <br>                     <li style="list-style-type: none;"><b>Student: </b><?php echo esc_html(get_post_meta(get_the_ID(), 'author', true)) ?></li> 

I’m quite new to WordPress (and quite frankly coding in general) and am stuck on where to actually include the above to only be found within the contents of the post. I’ve seen some tutorials suggesting to create a content-abstract.php file and add the details in there, but doing so would also add the entire post into the excerpt area of the post.

So the question is, where do you include the HTML code to display the details of the CPT, as seen below: enter image description here

Without also having to show this content in the excerpt? (like below)

enter image description here

In case it’s of any benefit, here are the contents of the default content.php file of the theme I am using

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php engage_mag_do_microdata('article'); ?>>     <?php     global $  engage_mag_theme_options;     $  engage_mag_show_image = 1;     if(is_singular()) {         $  engage_mag_show_image = $  engage_mag_theme_options['engage-mag-single-page-featured-image'];     }     $  engage_mag_show_content = $  engage_mag_theme_options['engage-mag-content-show-from'];     $  engage_mag_thumbnail = (has_post_thumbnail() && ($  engage_mag_show_image == 1)) ? 'engage-mag-has-thumbnail' : 'engage-mag-no-thumbnail';     ?>     <div class="engage-mag-content-container <?php echo $  engage_mag_thumbnail; ?>">         <?php         if ($  engage_mag_thumbnail == 'engage-mag-has-thumbnail'):             ?>             <div class="post-thumb">                 <?php                 engage_mag_post_formats(get_the_ID());                 engage_mag_post_thumbnail();                 ?>             </div>         <?php         endif;         ?>         <div class="engage-mag-content-area">             <header class="entry-header">                  <div class="post-meta">                     <?php                     engage_mag_list_category(get_the_ID());                     ?>                 </div>                 <?php                  if (is_singular()) :                     the_title('<h1 class="entry-title" ' . engage_mag_get_microdata("heading") . '>', '</h1>');                 else :                     the_title('<h2 class="entry-title" ' . engage_mag_get_microdata("heading") . '><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h2>');                 endif;                  if ('post' === get_post_type()) :                     ?>                     <div class="entry-meta">                         <?php                         engage_mag_posted_on();                         engage_mag_read_time_words_count(get_the_ID());                         engage_mag_posted_by();                         ?>                     </div><!-- .entry-meta -->                 <?php endif; ?>             </header><!-- .entry-header -->               <div class="entry-content">                 <?php                 if (is_singular()) :                     the_content();                 else :                     if ($  engage_mag_show_content == 'excerpt') {                         the_excerpt();                     } else {                         the_content();                     }                 endif;                  wp_link_pages(array(                     'before' => '<div class="page-links">' . esc_html__('Pages:', 'engage-mag'),                     'after' => '</div>',                 ));                 ?>                  <?php                 $  engage_mag_read_more_text = $  engage_mag_theme_options['engage-mag-read-more-text'];                 if ((!is_single()) && ($  engage_mag_show_content == 'excerpt')) {                     if (!empty($  engage_mag_read_more_text)) { ?>                         <p><a href="<?php the_permalink(); ?>" class="read-more-text">                                 <?php echo esc_html($  engage_mag_read_more_text); ?>                              </a></p>                         <?php                     }                 }                 ?>             </div>             <!-- .entry-content -->              <footer class="entry-footer">                 <?php engage_mag_entry_footer(); ?>             </footer><!-- .entry-footer -->              <?php             /**              * engage_mag_social_sharing hook              * @since 1.0.0              *              * @hooked engage_mag_constuct_social_sharing -  10              */             do_action('engage_mag_social_sharing', get_the_ID());             ?>         </div> <!-- .engage-mag-content-area -->     </div> <!-- .engage-mag-content-container --> </article><!-- #post-<?php the_ID(); ?> --> 

Thank you in advance.