![]() ![]() Appraise reminder dividing any number by 7, 11 and 13:-Ĭonsider the number 4523895099854, we have to calculate the reminder on dividing this number by 7, 11, 13 respectively. On dividing it by 37 we get reminder as 1 2. On dividing it by 27 we get reminder as 5 Now we have to make triplets as written below starting from units place. Appraise reminder dividing any number by 27 and 37:-Ĭonsider number 72487256, we have to calculate the reminder on diving this number by 27 and 37 respectively. There are math tricks for every mathematical operation you can think of: addition, subtraction, multiplication, division and so on. (c) Value which i write with echo will be get on that post / page.Ī math trick consists in the clever use of some mathematical properties, that are verified under certain conditions, which allows us to solve an arithmetic problem faster. and in your admin post / Page use “first” as short code (b) Then by using wordpress handler – “add_shortcode” define your function in it. (a) First make a function – Like i made “function wp_fetch_data()”. You can make shortcode in your plugin file or in function.php file… I made it in plugin file. $handler_function – (required, callable) It is a hook to run when shortcode is found. $shortcode_name – (required, string) It is a string that to be searched in the post. Then, you need to register a shortcode using add_shortcode() function.Īdd_shortcode( $shortcode_name, $handler_function) For using shortcode function, you have to define a handler function that parse the shortcode and return some output. WordPress offers a predefined shortcode function to create shortcode in WordPress plugin. You will learn how to create WordPress shortcode plugin.Įxample 1 – I am going to create a WordPress plugin to display text on any page or post of the website. Therefore, in this tutorial I am going to explain you how easily you can create your own shortcode using simple examples. But, WordPress makes it pretty simple to create your own shortcode by using WordPress shortcode function. Now in admin panel’s “DASHBOARD”, Click on Plugins – Under plugins you will find that your plugin has been made now activate it.įor the beginners, creating shortcode is sometimes not easy. Author URI: tp://fetchdata.in Upper five lines are the basic lines or you can say that basic thing which we use in making any plugin.ĭefine( ‘WP_FD_ABSPATH’, plugin_dir_path( _FILE_ ) ) Description: WordPress Fetch Data From Database using shortcodeĥ. Start working on that file using following code.ģ. How To Make a Simple Plugin: – For Making a plugin you only have to do following. (iii) Then start coding in your file to get value from database as i defined two parameters you cn use many more according to your requirement. (g) So first step is that – (i) Make plugin (f) i used two parameters in this short code (e) Now make a post in your admin dashboard and use this shortcode – Query_value(array(‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘showvalues’ => ”)) $result_query=$wpdb->get_results( “select $column from “.$a.””) įor($i=0 $i’.$result_row->$showcolumns.'’ Īdd_shortcode(‘fetchdata’, ‘wp_first_shortcode’) ![]() $get_columns=$wpdb->get_results(“describe “.$a.””) įoreach($get_columns as $fields) $showcolumns=$fields->Field (d) Like i want to fetch data using “Table name ” and “column name” so i mentioned it. (c) Then using attributes get your data form database, by using a keyword. (b) Then create a short code, as i described in my last post – “How to Create a Short Code”. (a) Firstly i did normal coding inside it to make it plugin – Or to run this file under my plugin. ![]() Make a file named ” fetch-data.php ” in your plugin folder “WP-Fetch-Data” under plugin directory. ![]() Make a folder named ” WP-Fetch-Data” in your plugin folder. I did something like this, which i am going to describe below. Some one asked me here that how to fetch data from database using short, Now i am going to describe or let you know that how to do that : – ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |