Meta Box clears saved field content

I found it, it was actually clearing when inputting apostrophe (‘) which conflicts in database save, to solve I used htmlentities() adn js replace to replace and save apostrophe with apostrophe code. <input onkeyup=”valid(this)” type=”text” name=”faq_2_title” style=”width:100%;” placeholder=”Tab Title” value=”‘. htmlentities($faq_2_title) . ‘”></input></h2> js: function valid(f) { f.value = f.value.replace(/’/g, ‘&#39’); }

Add WordPress Meta Box saved form input to WordPress RSS feed [duplicate]

I figured out the code to add to the above tutorial article about creating a Meta Box that saves values. This code puts the post meta into its own tag in the RSS. I added the post meta “meta-text” to the code below to work with the tutorial. add_action(‘rss2_item’, ‘add_my_custom_field_node’); function add_my_custom_field_node() { global $post; … Read more

Serving a custom featured image for mobile

I would do this with Advanced Custom Fields and a Sass mixin: @mixin image-2x($image, $width, $height) { @media (min–moz-device-pixel-ratio: 1.3), (-o-min-device-pixel-ratio: 2.6/2), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx) { background-image: url($image); background-size: $width $height; } } //Usage div.logo { background: url(“logo.png”) no-repeat; @include image-2x(“logo2x.png”, 100px, 25px); } Featured images or native custom fields could also … Read more

Change meta-box title- “LearnDash Quiz Settings” to “Quiz Settings”

You can do this via the available translation filters: add_filter( ‘gettext_with_context’, ‘gowp_replace_learndash_label’, 10, 4 ); function gowp_replace_learndash_label( $translation, $text, $context, $domain ) { if ( ( ‘LearnDash %s Settings’ == $text ) && ( ‘placeholder: Quiz’ == $context ) && ( ‘learndash’ == $domain ) ) { $translation = str_replace( ‘LearnDash ‘, ”, $translation ); … Read more

Wp Query sort order from custom MetaBox

With the guidance of @jacobPeattie below is the working example. Once I removed the commas everything was working great. I added number_format to the deal amount to automatically add the commas on the frontend. <?php $transaction = new WP_Query( array( ‘post_type’ => ‘transactions’, ‘paged’ => $paged, ‘posts_per_page’ => 50, ‘orderby’ => array( ‘meta_value_num’ => ‘ASC’ … Read more

Metabox with checkbox is not working true!

That error happened because the $savedusers is not an array — in_array() requires the second parameter be a valid array, and if it’s not, that error (or warning) is thrown. And a simple fix to that is by type-casting the variable to an array like so: $savedusers = (array) get_post_meta( $post_id, ‘U_S_C_users’, true ); Or … Read more

add meta box considers the selected option as post parent

Actually the problem is that i was giving the select option a name of “parent_id”, which for some how automatically used as post parent, but once i changed it to other name it worked. Working code: <?php function hfx_register_meta_boxes() { add_meta_box( ‘select_hfx_workshop’, __( ‘Workshop for’, HFX_DOMAIN ), ‘hfx_select_workshop_parent_meta_box’, ‘forum’, ‘side’,’core’); } add_action( ‘add_meta_boxes_forum’, ‘hfx_register_meta_boxes’ ); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)