Define PHP variable from a seperate API if statement

Hi I’m the author of Multi Rating Pro. The simplest way to do this is to put this logic within the rating-result.php template file. You can call the API function passing in your own result_type and then check this in the template. if ( class_exists( ‘MRP_Multi_Rating_API’ ) ) { MRP_Multi_Rating_API::display_rating_result( array( ‘rating_item_ids’ => 1, ‘show_count’ … Read more

Where to put random functions?

wp-includes/functions.php is never a file you should modify. Any mention of adding something to functions.php is never referring to this file. Functions related to front-end display or theme behavior should go in your theme’s functions.php. If the theme may potentially be updated, then you should be using a Child Theme to add functionality, and they … Read more

wp_create_category deprecated?

You are most probably trying to use wp_create_category() on the front end, which will lead to the fatal error. wp_create_category() is not available on the front end, only backend. You should hook your function to at least admin_init where wp_create_category() is available. Just a note, looking at the source code, wp_create_category() uses category_exists() which is … Read more

Limit dimensions of “Full” size images

So I’ve found this WP_Image_Editor in the CodeX. Basically by adding the code below it should automatically resize an image 🙂 Code: $image = wp_get_image_editor( ‘cool_image.jpg’ ); // Return an implementation that extends WP_Image_Editor if ( ! is_wp_error( $image ) ) { $image->resize( 300, 300, true ); $image->save( ‘new_image.jpg’ ); } I don’t know exactly … Read more

How i can put $_GET codes in function.php?

function custom_function_redirect() { if ( isset( $_GET[ ‘link’ ] ) && $_GET[ ‘link’ ] != ” ) { wp_redirect( $_GET[ ‘link’ ], 301 ); }else{ die(‘test’); } } add_action(‘template_redirect’,’custom_function_redirect’); Try this it worked for me. For redirection you should hook the function in template_redirect

Not all CSS elements transferring via parent to child?

good question! Basically, in your enqueue you call the Parent stylesheet first then the child, so any child styles (by definition of css specificity) will override the parent styles. Code example from the WordPress codex: https://codex.wordpress.org/Child_Themes <?php function my_theme_enqueue_styles() { $parent_style=”parent-style”; // This is ‘twentyfifteen-style’ for the Twenty Fifteen theme. wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ … Read more

echo custom fields with AJAX

I’m not sure Why you used loop to display your post meta. and you code are all ok but you have to change little-bit. Q. Why you used inline script ? On my opinion you should used external script file to do this. anyway that’s not the main issue here. In order to work with … Read more