Here you’ve did something wrong with $wpdb->table_name
. It will only return the default WordPress table names. Not custom table names. And also when you call $wpdb->prepare
then pass the parameter as array. So your function will be like below-
function get_info($postid) {
global $wpdb;
// Here I assumed that your table name is '{$wpdb->prefix}places_locator'
$sql = $wpdb->prepare("SELECT post_id, address, phone, email
FROM {$wpdb->prefix}places_locator
WHERE post_id = '%d'",
array( $postid )
);
$info = $wpdb->get_results($sql);
return $info;
}
Now if you do print_r
on get_info()
with parameter post ID then it will return you value.
Use like below-
print_r(get_info(1)); // Here I assumed your post ID is 1
Related Posts:
- Thesis -style Navigation
- registering a global template wordpress 6.0
- How can I wrap all blog posts image with
- theme style is applied on the dhasboard rather than the website
- Copying the theme style files and images to duplicate the website but with a difference
- Why still output /wp-content/themes/twentynineteen?
- I have WordPress setup on primary domain, how do I set it up on its subdomain using the same database?
- Which cache is kicking
- How to set Post meta-box defaults based on the choices made by user in Customizer?
- Theme Action to hook for one time only function [duplicate]
- Alignment Problem [closed]
- What $handle does WordPress use for a theme’s implicit style.css?
- searchform.php doesn’t work properly
- Issue when posting updates/changes to wordress
- Customizer: get_preview_url() inside customize_save_after hook
- Clearing dummy data before launch
- How to track a users last visited page?
- get_header action not working
- In a Gallery with limited image posts, how do I not limit images on single post?
- Shortcodes do not work in own template
- Adding Bootstrap to WordPress TwentySixteen Theme
- Unable to change the priority with ‘remove_action’ and ‘add_action’ in child theme
- LESS not working in WordPress [closed]
- StoreFront WordPress theme: How can i create a new Home page with Custom design same as template [closed]
- How do I include a partial from a directory below a wordpress theme directory?
- Is there a way to switch to another theme?
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- New to WordPress – Read the Codex, Other Docs; Still Confused
- How add built-in textarea in theme development?
- Create theme for mobile phones and tablets only?
- Unwanted empty line at the beginning of document
- How to add custom page elements to the WYSIWYG editor?
- Why is my container argument not working for wp_nav_menu() [closed]
- Remove h1 from 2015 theme
- Never actually adding the action? Or do I have to call the action?
- WordPress pulling in random page themes
- best practices for updating wordpress theme
- Why I obtain different visualization when I run the website on my local machine and on remote server?
- Some doubts about WordPress handle the horizontal main menu visualization
- Filter didn’t work on content class (hybrid_post_attributes)
- Can’t change theme name
- How to hide custom sidebar on mobile
- How to use the _S framework
- When trying to set title, not sure how to edit it for different pages
- How to remove permalinks links presents in each page of my site?
- first excerpt fine, subsequent post excerpts shift to the right instead of displaying vertically [closed]
- Post archives link yields a 404 Not Found
- Change Image Sizes for Mobile Theme
- Recommended sidebar / content widths
- Theme Checker Text Domain
- Converting a theme to a child theme in a network
- HTTP Error when uploading images over specific dimensions
- Get video from the post on homepage
- Why is the `if else` not working?
- help needed for suit designing tool
- static front page ONLY for certain themes?
- showing all recent posts in theme
- How to add cropped custom header image?
- Is there a way to serve different resolution images to different devices?
- What is the difference between Twenty eleven & roots framework?
- Open portfolio image in light box
- iPad WordPress theme?
- Let visitors show/hide a type of content
- custom Background not showing after upgrade?
- Rolling your own WordPress Themes
- WordPress Themes Directory: Template which hits the standards?
- Best practice for implementing a blog page / section in wp_menu_nav()
- How to modify theme content in Thematic?
- How to use multiple check-box values to work in a function and insert values in database
- How to make a function occurs for one time?
- List categories of a post hierarchically?
- How do I restructure the comment HTML layout?
- how to add a badge on product based on filter?
- How to change a local wordpress installation xml export file urls? and change them to what if you don’t have a live website?
- Any way to change/add to the theme name dynamically?
- Trying to link to a php template file but its blank
- Is there a list of default generated Gutenberg block CSS? Unable to align video blocks
- Let user to upload multiple time
- How to copy page/post from one theme to another?
- Not sure how to debug this npm install error. This is a wordpress theme that comes with a built-in gulp/webpack task automation [closed]
- How to update mark-up of a gallery block in a custom theme?
- PHP Parse error: syntax error, unexpected ‘endwhile’ (T_ENDWHILE), expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) on line 124
- How to change listing type permlink?
- Adding popup support to the theme
- Host Private Custom Theme
- Theme author.php transfer
- how to create/register menu items that can be added to menus later
- My wordpress theme name isn’t updating straight away
- Calling a WP Plugin Function’s Variable in Theme Template [duplicate]
- Why nav_menu_css_class doesn’t work with apply_filters?
- Custom Enfold theme tab layout not compatible with WPML
- Why front-page.php doesn’t show content of file instead shows loop
- WordPress and Semantic UI
- Customizer API Multi Sections in single Panel
- WordPress theme options checkbox default checked state
- Copying a modified theme from one wordpress site to another wordpress site [closed]
- How can I change this SVG shape that’s generated?
- How to make updatable custom WordPress theme?
- How can I access variables from theme in child theme? [closed]
- Theme does not allow shortcodes