Admin meta Image Path

Unfortunately your question is still unclear after all the explanations, but based on your efforts, I guess you need to pass the image’s URL to a meta field or some sort of array. So, turning your current code into this will fix the issue: ‘img1’ => ‘<img src=”‘.get_template_directory_uri().’/inc/admin/images/layout.png” alt=”Image 1″ title=”Image 1″>’

How can I store a file in the database in the same way WordPress and ACF do?

ACF doesn’t store any file in Database, it simply provides meta fields with user friendly interface. You can however, store them yourself. To store a field, you need to be familiar with PHP a bit. Here’s how saving a meta field happens, by using the add_post_meta() function: add_post_meta ( $post_id, ‘meta_key’, ‘meta_value’, $is_unique ); There … Read more

Save the_content into custom field

You can get the content with $_REQUEST, Try the below code: add_action(‘publish_post’, ‘save_content_to_field’); function save_content_to_field($post_ID) { if(isset($_REQUEST[‘content’])) { update_post_meta($post_ID, ‘desc’, $_REQUEST[‘content’]); } } UPDATED With the below code if you want to sore with shortcode support: add_action(‘publish_post’, ‘save_content_to_field’); function save_content_to_field($post_ID) { $post = get_post($post_ID); $result = apply_filters(‘the_content’,$post->post_content); if($result) { update_post_meta($post_ID, ‘desc’, $result); } }

Add Custom Field to a template page backend

You need to create metabox (contains custom fields with a form) for your post/page or custom post type. When you use your code block above, you only call for meta values of post. But if WordPress can’t find any custom field or meta value, these variables retun null (and you can not see any value) … Read more

Conditionally hide or show woocommerce product variation in fontend by custom field

I ultimately solved this by manipulating the $options array. See full code below for conditionally hiding a product variation by a custom field, and display variations as radio buttons. Solution marked with comments /** * Convert WooCommerce variation dropdown to radio buttons. * * @param string $html Original dropdown html. * @param array $args Arguments. … Read more

two custom fields question

All you have to do to hide this link is to check, if it’s empty: <?php if ( $link = get_post_meta($post->ID, ‘mp3_link1’, true) && trim($link) ) : ?> <a href=”https://wordpress.stackexchange.com/questions/326188/<?php echo esc_attr($link); ?>” target=”_blank”>MP3</a> <?php endif; ?>

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