Nesting functions in PHP very rarely makes sense. There are some advanced reason for doing it, but I doubt they are needed in this case.
class TweetFeedIt {
function tweet_feed_it() {
function twitter_username_callback() {
function tweet_count_callback() {
[...]
}
}
}
}
The add_action()
function can take up to 4 parameters, but those parameters are not the names of the nested functions you wrote above.
add_action('wp_head', 'tweet_feed_it', 'twitter_username_callback', 'tweet_count_callback');
Read the documentation for PHP, for add_action()
and for adding scripts. PHP does exactly what you tell it to do, but you have to follow the conventions of the language.
Related Posts:
- force enqueue script to be first in order of prominence
- How do I force wp_enqueue_scripts to load at the END of ?
- How can I modify what is being output in wp_head, whether by a theme or WordPress in general?
- Change Page’s Tag Using functions.php File
- How can I reduce the amount of files loaded/included per plugin?
- Add code into on a per page/post basis
- How to load different css file for different pages
- append stylesheet via shortcode
- How to load plugin before the wordpress jquery?
- Disable wordpress from including jQuery in the head section
- How to add inline css/js inside a shortcode
- add action wp_head not working
- adding meta data using plugin to top of head
- Create mobile navigation header with settings integration
- CSS from textarea in options page to frontend what to do
- wp_footer hook only working on homepage not in other pages
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Adding Plugin Assets to Header
- wp_enqueue_style on template_redirect level?
- How to manipulate the content within wp_head
- Grab ID from post from plugin and use it to create an object
- is there a way to preload specific images for desktop users only? (excluding mobile users)
- i create functions.php in plugin files but add_action (‘wp_head’, ‘function_name’) don’t work
- Loading a plugin in a post template without using wp_head()
- How do I override WordPress plugin css [closed]
- Update javascript URL in header – Domain Mapping Plugin [closed]
- Front End Page Not Loading Header Footer
- Best use adding user generated JS/CSS to a theme with a plugin
- How to Add WYSIWYG Editor (tinyMCE) to plugin options page compatible with WordPress 3.0 and up?
- What is a Network Activated Plugin Exactly?
- How to distinquish wordpress served links from non-wordpress served links
- How to set all external links to a certain domain to “nofollow”?
- do_shortcode() doesn’t work if shortcode contained in variable, works if shortcode passed as string
- htaccess and wordpress config files are regularly over written
- Issue with post request to admin-post.php
- Built in audio player?
- How to add class in plugin only for network site?
- Add category to body class
- Plugin Development sqlite or WordPress’ database
- WordPress plugin for activating other plugins
- woocommerce 3.2.1 not sending order notification emails
- CSV file generation failing
- How would I disable a plugin on one page?
- Buddypress – Add the post_id in the bp_activity_add function
- Automatic switch to backup database on fail
- How to remove custom post type and add category and post name
- Paypal Integration [closed]
- Remove hovercard for only certian gravatars
- wp-custom-menu filter removes the current_page_item class
- Can I allow certain people to add/edit pages within a parent?
- Is there a loading priority for login_enqueue_scripts?
- How to apply lazy loading in background images [closed]
- How can I test plugin activation using phpunit?
- WordPress custom taxonomy not showing
- Any reason not to remove all default WP plugins?
- Determining when was the last time a plugin was activated
- A question about register_activation hook
- Software to run on server checking outdated wordpress installations
- Integrating boxtal PHP library into a custom WordPress Plugin
- Changing menu order of a specific plugin in dashboard
- Test my WordPress Plugin standard or not
- issue in wp_localize_script
- Sanitize $_GET variable when comparing
- Where can I save plugin data?
- shortcode – multiple instances of same parameter name in one shortcode instance
- Is there a counter for comments left?
- Modifying post titles on pages, archives and single but not dashboard/admin
- How to add update function to plugin without adding it to https://wordpress.org/plugins/ [closed]
- is there a way to pass a parameter to a add_menu_page function?
- How to edit link for comment count
- Personalized Author Area
- WP-ecommerce : Change the price before inserting it into the cart
- Integrating Custom Database with WordPress
- How do I duplicate a single wpmu site?
- TranslatePress | secondary language category/sub-category not working correctly “`/%category%/%postname%/“`
- Live Streaming with WordPress?
- How to add height and width to images on a page(using WP Bakery) to improve Google’s CLS score?
- I need to register and resize images, safe to delete plugin afterwards?
- How to edit checkout page? [closed]
- How to send custom mail when a user complete a specific form
- How to echo meta_key in easy digital downloads receipt (Purchase Confirmation page)
- Generating shortcode and HTML on button click
- Show content from plugin on index
- “Listen” button on my main post page
- Add custom field for users
- How to include css for plugin setting page? [duplicate]
- County Finder form/plugin?
- avatar displays outside of targeted area
- Adding hero images to blog posts
- How wordpress plugin hooks works? [duplicate]
- Gtranslate function with custom menu
- WP Customer Reviews call short code on another page [closed]
- Plugin: Custom menu item problem
- Getting warning of Missing argument 2 for wpdb::prepare()
- wordpress plugin noob situation
- turn off WooCommerce for a site in a multi site environment
- WDTException: [0]: One or more columns doesn’t have a header
- How to Add Extra Text In WordPress Title Before Post Publish
- WordPress Convert queries to slashes using function.php
- 404 Error on a WordPress Website, Error disappears for a while and again appears