Questions tagged [function-exists]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
60 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
1answer
470 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
1answer
307 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
4answers
566 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 ...
0
votes
3answers
1k 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
1answer
3k 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
1answer
41 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
2answers
311 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
1answer
75 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
1answer
111 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
1answer
498 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
1answer
1k 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
1answer
5k 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
1answer
74 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
1answer
80 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
3answers
2k 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
4answers
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
1answer
46 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
1answer
2k 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
2answers
1k 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
1answer
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
4answers
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 ...