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 my file to changes some css. Here is my function in my_parent_theme/include/addon/myfile add_filter( 'larismanis_style', 'larismanis_wc_cart_popup_style' ); function larismanis_wc_cart_popup_style( $style ) { if ( larismanis_get_integration_wc( 'wc_cartpopup_disable' ) ) { return $style; } $style = $style.'.tp-cart-popup .modal-body { padding-bottom:0; }'; $style = $style.'.tp-cart-popup button.close { background: none; border: none; …
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 ".wp_get_post_categories ($post_id)." but I could not find any solution. Please help me with that and if you need closer to the code just let me know. 1st Block $related_blog .="<div class='related-blog'> <div class='row'> <a href=".get_the_permalink()."> <div class='col-lg-4 col-md-4 col-xs-4 blog-image'> <img src=".$image_related[0]."> …
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 after sending email to admin and user (user registration), and then I must remove these added elements to verify if email exists or display on user account or use for mailing list. To decrypt the email I must use substr whith the value associated to $email field of get_user_by to …
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 several php files in its "framework" folder. The function I am targeting is in fonts.php, called wpex_standard_fonts: if ( ! function_exists( 'wpex_standard_fonts' ) ) { function wpex_standard_fonts() { return array( "Arial, Helvetica, sans-serif", "Arial Black, Gadget, sans-serif", ... ); } } So, from what I …
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('houzez_number_shorten')) { function houzez_number_shorten($number, $precision = 0, $divisors = null) { $number = houzez_clean_price_20($number); if (!isset($divisors)) { $divisors = array( pow(1000, 0) => '', // 1000^0 == 1 pow(1000, 1) => 'K', // Thousand pow(1000, 2) => 'M', // Million pow(1000, 3) => 'B', // Billion …
I have the following parent theme function located in inc/template-tags.php if ( ! function_exists( 'twentysixteen_excerpt' ) ) : /** * Displays the optional excerpt. * * Wraps the excerpt in a div element. * * Create your own twentysixteen_excerpt() function to override in a child theme. * * @since Twenty Sixteen 1.0 * * @param string $class Optional. Class string of the div element. Defaults to 'entry-summary'. */ function twentysixteen_excerpt( $class = 'entry-summary' ) { $class = esc_attr( $class ); …
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't edited anything in the functions.php or any code for that matter.
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 get_field() method works fine if ACF plugin is active, but when the plugin is not active the theme front-end throughs the following error: Fatal error: Call to undefined function get_field() Now, I tried to provide a fallback function, which should be used when the plugin is not …
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 would exist? P.S.: I should hook my function to an action in loading process and before site is loaded completely.
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 for my plugin right now, I couldn't find a declared hook, do_action or apply_filter, within the function in the wp-admin/includes/plugin.php file. <?php function run_activate_plugin( $plugin ) { $current = get_option( 'active_plugins' ); $plugin = plugin_basename( trim( $plugin ) ); if ( !in_array( $plugin, $current ) ) { $current[] …
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? In footer.php, I have this, which I can modify in the child theme. <footer id="colophon" class="site-footer" role="contentinfo"> <div class="container"> <div class="row"> <?php do_action('talon_footer'); ?> </div> </div> </footer> If I modify <?php do_action('talon_footer'); ?>, the whole footer is gone. The talon_footer action is found in …
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 function_exists() is ~3 times faster where both the function and filter exist. and ~11 times faster if the filter does not exist. Was not expecting this. function taco_party() { return true; } add_filter( 'taco-party', 'taco_party' ); timer_start(); for ( $i = 0; $i < 1000000; $i++ …
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 exists in the footer and in case it doesn't I would like to show an exit(); function. I am also planning to encode the footer and functions php code. I tried function_exists() but it works only if the function I am checking is …
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 the code to already activated plugin - everything is working as expected. Is there something obvious that I'm missing? Here's a simplified example of the code I'm using: // In my theme I use function_exists check if ( ! function_exists( 'my_awesome_function' ) ) { …
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 was thinking to manually add ob_start() at the beginning of the theme header and clear the document when necessary. I thought of using grep find if there are any ob_start() in wordpress, but i can't grep find everytime my website gets updated. Are there …
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 pretty bored writing if.. endif blocks. I know I can create new classes to avoid this . But can I do this in this way? if (!function_exists('theme_add_next_page_button')) { function theme_add_next_page_button(){ // function blocks } add_filter( 'mce_buttons', 'theme_add_next_page_button', 1, 2 ); } Can I remove function conflict by this way? If there are otherways,what …
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 I want my overridden function to work instead of other plugin that is overriding the same function (wp_new_user_notification). May be a silly question but can I do it ??
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' ) ) : function TaskerDev_get_first_post_image_fnc($pid, $w = 100, $h = 100) { //--------------------- // build the exclude list $exclude = array(); $args = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $pid, 'meta_key' => 'another_reserved1', 'meta_value' => '1', 'numberposts' => -1, 'post_status' => null, ); $attachments = get_posts($args); if ($attachments) { foreach …
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( 'my_header_function ) ): my_header_function(); else: /* carry on and output the default header... */ endif; Now as my hero header depends on whether the image and logo have been uploaded I wonder if I can manually return a 'false' result from my hook in order to have the original …
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 if ( have_posts() ) : ?>... <?php while ( have_posts() ) : the_post(); ?> <? if( post_type_exists( 'mobiles' ) ) { echo 'The Products post type exists';} ?> <?php get_template_part( 'content', get_post_format() ); ?> <?pp echo 'The post type is: '. …