How can i upload images in an admin page?

First of all edit_user_profile and show_user_profile action hooks don’t have to save the image, you can just add a field there. So function image_up_gall(){ ?> Select image to upload: <input type=”file” name=”fileToUpload” id=”fileToUpload”> <input type=”submit” value=”Upload Image” name=”submit”> <?php } add_action(‘edit_user_profile’, ‘image_up_gall’); add_action(‘show_user_profile’, ‘image_up_gall’); It is because WordPress has its own form tag already, just … Read more

dynamic page in WordPress

Since the wp_brands is your own custom table, I would recommend passing the brand the user clicks on via Query String: http://example.com/your/permalink/?brand=xyz You can access this via PHP in your page template(not the wp-admin editor) like this: $_GET[‘brand’]; Once you have that you can use whichever brand the user chose to query the database. This … Read more

Where Does WordPress Make cURL Requests? How To Add cURL Option

Not sure about your specific cURL script but the base cURL function can be found here inside of WordPress: https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/class-wp-http-curl.php#L220 Also remember modifying WordPress core can cause issues so it’s always best to try to leverage hooks and filters. You may be able to modify the default cURL request via http_api_curl. https://developer.wordpress.org/reference/hooks/http_api_curl/ This article also … Read more

jQuery not defined

The dependencies argument of wp_enqueue_script() is case sensetive: wp_enqueue_script(‘customjs’, get_template_directory_uri() . ‘/js/paramo.js’, array(‘jQuery’), ‘1.0.0’, true); That array(‘jQuery’) needs to be array( ‘jquery’ ). You can see the handles for bundled scripts on the documentation page for wp_enqueue_script(): https://developer.wordpress.org/reference/functions/wp_enqueue_script/

How can I load a PHP page without using a Template?

I think what you’ll want to do – or something like what I’d do in your place – is create a simple WordPress plugin. (I’m bold-facing things that you can search up – lots of material on all of this will be right at your fingertips on the internet, often in detail in the WordPress … Read more

Function not working at one place

This is because you have functions that work only inside of the WordPress Loop like get_the_id(). This will return the correct value inside the WP Loop in template files, but when called in other places does not return the correct value and check fails. See this for more information on the WordPress loop https://codex.wordpress.org/The_Loop When … Read more

Custom filter in admin edit custom post type responding with invalid post type?

I am also get the issue same as you and finally I got the solution. We have to add $query->is_main_query() in IF CONDITION. if( ‘trip’ == $type && is_admin() && $pagenow==’edit.php’ && isset($_GET[‘tripstatus’]) && $_GET[‘tripstatus’] != ” && $query->is_main_query()) { $value = $_GET[‘tripstatus’]; $query->query_vars[‘meta_key’] = ‘trip_status’; $query->query_vars[‘meta_value’] = $value; } I hope it will help … Read more

Getting a specific post values to another div or modal

You can do it in different ways: Json Encode This is my favorite way of passing data/settings/etc to the front-end. PHP $obj=array( ‘content’ => $post->post_content, ‘title’ => esc_html( get_the_title() ) ); Now the button output will be like this: HTML <button class=”btn btn-primary tag_cnt get_button_more_info” type=”button” value=”<?=json_encode($obj)?>”></button> Javascript (function($) { $(‘.get_button_more_info’).on(‘click’,function() { var obj = … Read more

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.