proper way to add css using functions.php?

Your add_action() is incorrect: add_action(‘wp_enqueue_scripts’, ‘wp_enqueue_style’); The 2nd argument is supposed to be the function that you enqueue your stylesheet in. In you case that’s fearnothing_script_enqueue(): add_action( ‘wp_enqueue_scripts’, ‘fearnothing_script_enqueue’ );

Why File_exists returns true with or without ABSPATH?

AFAIR, if you use file_exists with relative paths, you have to be very careful, because the path is relative to script that is called by request and not relative to file that contains that check… So if it’s a plugin and the request goes to main WP index.php, then you’ll be looking for a file … Read more

Way to bulk make all my tags lowercase?

I would highly suggest that you use CSS to do this, as mentioned per other answer. Still, if you need to update the database due to some technical business, here’s the way to go. First, we will try and fetch all the tags using the get_terms() function, then we will update everyone of them using … Read more

Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose

You can’t define a hook callback function inside another function. You’ve defined my_custom_sizes() inside setup(), which means that my_custom_sizes() cannot be called outside of the scope of setup(). This is a problem because the hook, image_size_names_choose, is not run inside your setup() function. You need to define your callback in the global scope: function setup() … Read more

Do wordpress create a new file for each new post?

You’re asking several questions: Does WP create a new PHP file for each post? No, it does not. Your statement, “[insert] a database [record],” is correct. The record it creates for a post (and also many other post types) is in the wp_posts (your prefix may not be wp_) table. Is it SEO-friendly? This is … Read more

get_template_part for specific page

This is just a supplement to the other answer. I am trying to load fd-blog.php if it is the ‘Blog’ page, otherwise load the fd-default.php To actually load the template file, you should remove the dash (-): get_template_part( ‘inc/fd’, ‘blog’ ); // loads inc/fd-blog.php get_template_part( ‘inc/fd’, ‘default’ ); // loads inc/fd-default.php So just inc/fd, and … Read more

Concatenate output of php function into string

You can use output buffering like: $output_settings .= ”; ob_start(); settings_fields(‘fahad_plugin_cpt_settings’); submit_button(‘Delete’, ‘btn btn-danger btn-sm’, ‘submit’, false); $output_settings .= ob_get_clean(); and use $output_settings variable in your code like // …your code… $data .= ‘<form method=”post” action=”options.php”>’; $data .= $output_settings; $data .= ‘</form>’; // …your code…