Questions tagged [function-exists]
The function-exists tag has no usage guidance.
30
questions
0
votes
0
answers
2k
views
a problem in class in class-wp-hook.php
I get the problem this morning
Warning: call_user_func_array() expects parameter 1 to be a valid
callback, function 'wp_ob_end_flush_all' not found or invalid function
name in /home/legotechnic/...
2
votes
1
answer
125
views
Why would someone use function_exists('add_action') in a plugin?
I inherited the code of a proprietary plugin, and am now trying to clean it up.
At the start of the main some_plugin.php file, there is this code:
// Make sure we don't expose any info if called ...
1
vote
1
answer
40
views
Modify some CSS with functions if (function_exists
I have code function php in my parent theme as path my_parent_theme/include/addon/myfile. I have tried using get stylesheet to load the parent function with no succeed. I just dont know how to handle ...
0
votes
0
answers
31
views
Php string not working in Wordpress Functions.php (trying to fetch 1st category for each blog that post appears in the sidebar)
I am trying to fetch 1st category for each blog post that appears in the sidebar of any blogpost landing page.
I tried multiple options to add the 2nd block code to the 1st block at the line "....
0
votes
1
answer
371
views
How to apply a function to the value $email of get_user_by to override email_exists?
More precisely questions : How to override email_exists via get_user_by ?
I have chosen to render unusable/unreadable email adresses from database.
I added a few elements(chars) to email address just ...
0
votes
1
answer
27
views
Need to replace Currency Shortforms
I want to replace the currency shorten alphabet, it is currently in M, L and So on.
I want to change to indian currency number format like K, L and CR
below is code:
if(!function_exists('...
0
votes
0
answers
75
views
parent theme function doesn't affect child theme post output
I have the following parent theme function located in inc/template-tags.php
if ( ! function_exists( 'twentysixteen_excerpt' ) ) :
/**
* Displays the optional excerpt.
*
* Wraps ...
0
votes
0
answers
39
views
I have an fatal error on my funcyions.php
can someone please help me with this
Fatal error: Uncaught Error: Call to a member function main() on null in /home/customer/www/real-amnesti.com/public_html/wp-includes/functions.php:1255
I haven'...
0
votes
0
answers
139
views
Plugin Development - Call to undefined function comment_exists()
In my plugin I hooked my function to wp_loaded and there is a call to the function comment_exists() which fires a Fatal Error. In which hook in the loading process I can be sure that the function ...
0
votes
1
answer
1k
views
How can I modify footer when footer.php calls to another file?
I am trying to modify the footer of aTheme's Talon theme. I am using a child theme that works properly. How can I modify the footer when footer.php calls for a function that is in function-footer.php?
...
0
votes
1
answer
725
views
Check from functions.php if function exists in footer.php
I am trying to secure the copyrights links from footer.php file and I want to create a function in footer php which will have those links and then I want to check from functions.php if that function ...
1
vote
4
answers
1k
views
Redeclare theme's function in a plugin
I'm trying to figure out how to redeclare a theme's function from within a plugin. The problem is that I'm getting a "Fatal error: Cannot redeclare" when trying to activate the plugin. But if I add ...
1
vote
3
answers
2k
views
Providing fallback function and allow override by plugin
I'm using ACF (Advance Custom Fields) plugin in my theme. This plugin provides a simpler methods get_field() which we can use in place of WordPress native get_post_meta() method. Now, the issue is the ...
0
votes
1
answer
6k
views
Clean way of using ob_start() and ob_end_clean() in wordpress
I want to pass some json data to JS from wordpress(PHP) and was thinking to use ob_start() and ob_end_clean() in wordpress but i am not sure weather any other plugins are using the same functions. I ...
-1
votes
1
answer
52
views
Bestway to write php functions
I have seen that every theme use this format
if( !function_exists( 'blogrock__f' )) :
function blogrock__f () {
/// code here
}
endif;
add_action('after_setup_theme', 'blogrock_setup');
I am ...
1
vote
2
answers
423
views
override pluggable.php functions
I just not only want to override a pluggable function (wp_new_user_notification) but I want to make sure that if any other plugin is overriding the same function, so my function , override that too or ...
1
vote
1
answer
106
views
How to replace a function using a child theme?
I have the following function where I would like to replace the image nopic.jpg
I have updated by deleting some redundant options.
if ( ! function_exists( 'TaskerDev_get_first_post_image_fnc' ) )...
0
votes
1
answer
275
views
Manually return false for function_exists
I'm having a run at developing a theme options plugin and right now working on implementing a 'hero' header, checking first to see if my plugin is active using:
if( function_exists( '...
1
vote
1
answer
756
views
Override a theme function in a child theme?
Most if not all of the answers to this question are pretty old, or are for edge cases.
I have a child theme for a commercial theme ("Total"). The parent theme's functions.php loads functions from ...
2
votes
1
answer
2k
views
if custom post type exist
I want to test if custom post type mobile exist. I used if custom post type exist in the loop, but it doesn't work. Any suggestion why my code is not working
<?php /* The loop */ ?>
<?php ...
0
votes
1
answer
8k
views
wp_star_rating() - Adding a 5 star rating system to theme
My goal is to add a 5 star rating system to my theme. I read that there's a function wp_star_rating in wp-admin/includes/template.php on line 2121, that I've been trying to use for the ratings. I am ...
0
votes
1
answer
101
views
How to Overwrite validate_plugin function
How can I overwrite the WordPress validate_plugin function. I need to disable that function alone for my plugin, and it should not affect any other plugin.
I don't want the validate_plugin function ...
0
votes
1
answer
321
views
Retrieve array of attachment IDs attached to a given Post ID
I wonder if there's a function to retreive an array containing the attachment IDs of images that are atatched to a given post. Some function like get_post_arry($pid);
The array should be ordered like
...
2
votes
3
answers
3k
views
Where does function_exists() look to decide whether a function exists? [closed]
The documentation says:
Checks the list of defined functions, both built-in (internal) and user-defined, for function_name. ( SOURCE: http://php.net/manual/en/function.function-exists.php)
Does ...
4
votes
4
answers
1k
views
Include jQuery UI as a whole
Is it possible to include jQuery UI as a whole instead of:
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-effects-core');
// a lot of other jquery ui imports....
I've searched in the ...
0
votes
1
answer
84
views
If post exists, make it a comment in existing post with same name?
Is it possible to make a comment out of a post that already exists (with the same name). For example, if the post 'Hello World' exists and a users posts another 'Hello World' post, it should make the ...
0
votes
1
answer
3k
views
check if a file in a plugin folder exists from a locale installation
I need to check if a file exist in my plugin dir:
if (fileexists) {
...
}
else
{
...
}
However, if in place of fileexists I use file_exists(WP_PLUGIN_DIR . "/myplugin/myfile.ext") it returns always ...
1
vote
2
answers
2k
views
Twenty Eleven Child theme error when attempting to use a rewritten function
I attempted to make a minor change to a function in the Twenty Eleven theme (wordpress 3.4.2)
I get this error message:
Fatal error: Cannot redeclare twentyeleven_widgets_init() (previously declared ...
-1
votes
1
answer
2k
views
wordpress Search function is not working
My wordpress Website Version is 2.8.1,This is the Custom wordpress website done by 2 years ago.[Link Removed... i got Solution][1]Now Search functionality is not working(It was working well earlier.)
...
4
votes
4
answers
1k
views
Is calling function_exists() faster or slower that apply_filters()
Is calling function_exists() faster or slower that apply_filters() ... or is the difference so small that it should not be considered?
I did a bit of testing based on Kaiser's and it showed that ...