Use Tags to initiate Search

I used a workaround for now. I eddited the category_template.php with the str_replace function. The problem turned out to be that the Tag Cloud used diffenten functions than the regular Tags. I just added this: foreach ( $tags_data as $key => $tag_data ) { $class = $tag_data[‘class’] . ‘ tag-link-position-‘ . ( $key + 1 … Read more

How to create table in wordpress without plugin? [closed]

I am not sure i understand the question but if ur looking to create a table you can do it with simple HTML and CSS. Take a look at this: https://www.w3schools.com/html/html_tables.asp Again, if you need this in all posts then you might consider adding this code inside your theme’s loop.php (or other equivalent file which … Read more

How to make multiple admin pages for one plugin?

Using add_submenu_page function WordPress you can add multiple pages/menu In order to add a new top-level menu to WordPress administration dashboard, You can use add_menu_page() function. This function has the following syntax. //add plugin menu add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position); As you can see, The function accepts the following parameters. page_title: The page … Read more

How to loop through all the attached images in a post, and get their url one by one

Put this in the template file at the beginning or in functions.php file: function get_images_attachment_url() { global $post; $images_urls = array(); $images_objects = get_attached_media( ‘image’, $post->ID ); foreach ($images_objects as $image_object) { $images_urls[] = wp_get_attachment_url ($image_object->ID); } return $images_urls; } When you need to call them use foreach after calling the function get_images_attachment_url(): $my_images_urls = … Read more

Error using WordPress $wpdb object to get result from custom table

I have checked your code and I think there are the couple of things you have to consider: table prefix column name validate get_results function output Firstly, the original prefix is defined in wp-config.php. The WordPress $wpdb class provides a variable $prefix. Always use $wpdb obefore table name and it will automatcially insert the table … Read more

Using and saving custom dropdown boxes on user profiles

You are storing the data in the $selected value, while using $topselected in the conditionals to check which value is selected. Either change your value like this: $topselected= get_the_author_meta( ‘user_top’, $user->ID ); OR change your inline conditionals to this: <option value=”MPF Pune West:” <?php echo ($selected== “MPF Pune West:”)? ‘selected=”selected”‘ : ” ?>>MPF Pune West:</option> … Read more

How to make container class in PHP

You can do this using below code. if ($slide_title) { $strret .= ‘<div class=”container”>’; $strret .= ‘<a class=”‘.$slide_linkurl.'”><h2>’.$slide_title.'</h2></a>’; $strret .= ‘<p>’.$str.'</p>’; $strret .= ‘<a href=”‘.$slide_linkurl.'” class=”da-link”>’.$slide_linktext.'</a>’; $strret .= ‘</div>’; }