Questions tagged [function-exists]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
25 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
1answer
45 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
1answer
19 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
0answers
20 views

Wordpres specific function

I'm in need of a function to check content from a certain part of the site and print it on the main header. Any idea of how can i do this? It's a radio website. What i need to track is the content of ...
0
votes
0answers
15 views

Past post meta into Visual composer Params value

I want to update my lists in Edit Visual composer Element using postmeta data. But it only show yes instead lists. I use vc_map_update() to check if post meta not empty is change lists. here my code ...
0
votes
1answer
69 views

pll__() polylang function undefined when replacing __() in plugin

We use Splitit to process certain payments and are trying to implement translations with polylang. Simply, we are replacing () with pll() and registering the strings in functions.php The issue is that ...
0
votes
0answers
18 views

Woocommerce, If Purchase more then 9, change Role!

I got this code and its working great. add_action( 'woocommerce_order_status_processing','change_role_on_purchase' ); function change_role_on_purchase( $order_id ) { $order = ...
0
votes
0answers
63 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
0answers
32 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
0answers
89 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
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
1answer
548 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
979 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
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
1answer
4k 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
46 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
365 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
87 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
183 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
664 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
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
1answer
7k 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
89 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
175 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
57 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
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
2answers
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
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 ...