how to make separate field in wordpress user_data_

This is the serialized string. You need to unserialize it: $raw = get_user_meta($current_user->ID,”Tw941I8fXg_s2member_custom_fields”,true); $data = maybe_unserialize($raw); extract($data); Now, $data will have an array of all options, and the extract will turn each element into a variable with a value.

Image as Sales Badge

Change your image url to “/wp-content/uploads/2018/01/in-stock.png” That way even if you change servers (or changed domain name), as long as the filepath doesn’t change from wp-content, you’ll still be safe.

Inserting HTML tag with ACF into shortcode

You have to use do_shortcode() to execute shortcodes in your string Full code should be like that <?php function my_shortcode( $atts ) { $atts = shortcode_atts( array( ‘post_id’ => ”, // Default value. ), $atts ); $output=”https://wordpress.stackexchange.com/questions/291524/[acf field=”image” post_id=”” . $atts[‘post_id’] . ‘”]’; $output = do_shortcode( $output ); $output=”<img src=”” . $output . ‘” />’; … Read more

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name

I would start by creating in the themes functions.php a function like this public function greenday_head($args) { return $args } It may be that $args are never passed in but it seems likely they are. If you want to try to find out what this is doing then you can add: public function greenday_head($args) { … Read more

I did group my search results by post type, but how can i give each of them its own order?

Here’s one suggested high level approach to get the desired effect. Rather than perform all your operations in one big while loop in your searchresults.php, try: establishing three arrays corresponding to each type- you can do this in one while loop. then sort each array as needed (refer to PHP’s Sorting Arrays documentation for the … Read more

Ajax not working properly

Just saw it… …in your HTML, take the action out entirely. We’re not using the HTML to tell the form/submit button what to do, we’re using JS/AJAX for that. <form method=”POST” action=”<?php echo admin_url(‘admin-ajax.php’); ?>” id=”modal-form-ajax” autocomplete=”off”> Should become: <form method=”POST” id=”modal-form-ajax” autocomplete=”off”> Also, instead of targeting the form, target the submit button, so the … Read more

Adding Default Settings to Theme My Login plugin

The data wasn’t fully unserialized and properly made as a multidimensional array wp_parse_args() used unnecessarily. get_option() used unnecessarily. function nls_tml_default_settings() { $nlstml = array( ‘enable_css’ => 1, ‘login_type’ => ‘default’, ‘active_modules’ => array( ‘custom-passwords/custom-passwords.php’, ‘custom-user-links/custom-user-links.php’, ‘recaptcha/recaptcha.php’, ‘security/security.php’, ‘themed-profiles/themed-profiles.php’, ‘user-moderation/user-moderation.php’, ), ‘version’ => ‘6.4.10’, ); update_option( ‘theme_my_login’, $nlstml ); $nlsrecap = array( ‘public_key’ => ‘sitekey’, ‘private_key’ … Read more

Automatically wrap multiple images in div

This is a function I use to add a wrapper to each image. I know it’s not 100% what you want, but I thought this might give you a handle to work from. function add_image_wrapper( $content ) { $content = preg_replace_callback( ‘/<img[^>]+>/im’, function ( $matches ) { $image = $matches[0]; $classes = array(); preg_match( ‘/class=”align([^”]+)”/im’, … Read more