is_front_page not working in functions.php

Even though this question may get down voted – because not enough information has been provided and it’s fairly easy to find tutorials elsewhere, I’ll help you out. In your functions.php file in your theme, you need to do this: add_action( ‘wp_enqueue_scripts’, ‘wp5849_scripts’ ); function wp5849_scripts() { if ( is_front_page() ) : wp_enqueue_style(‘TBDhome’, get_stylesheet_directory_uri() . … Read more

Current post’s author name in the author meta tag

You cad add it via functions.php with a hook, instead of inside the loop (you don’t really want to add a loop to header.php): function add_author_meta() { if (is_single()){ global $post; $author = get_the_author_meta(‘user_nicename’, $post->post_author); echo “<meta name=\”author\” content=\”$author\”>”; } } add_action( ‘wp_enqueue_scripts’, ‘add_author_meta’ );

Conditional check for front-end which includes ajax

DOING_AJAX and WP_ADMIN (this constant is checked within is_admin() ) are defined in admin-ajax.php and set tro true. Both are not very helpfull in this situation. Add a parameter to your ajax request if the request come from the front-end: <?php function my_action_javascript() { ?> <script type=”text/javascript” > jQuery(document).ready(function($) { var data = { action: … Read more

How do I conditionally enqueue script for CPT single post type with plugin?

Make sure your code runs in wp_enqueue_scripts action hook. Also checkout your script handle ‘owl.carousel.js’. In wp_script_is(), it is not the same than in the 2 later functions in which you enter it as ‘owl.carousel.min.js’. add_action( ‘wp_enqueue_scripts’, ‘enqueue_properties_scripts’ ); function enqueue_properties_scripts() { if ( ‘properties’ === get_post_type() ) { if ( wp_script_is( ‘owl.carousel.min.js’, ‘enqueued’ ) … Read more

how to check if front page is set to show a static page

Your conditional logic makes sense as well but you’re probably looking for this: if ( ‘page’ == get_option(‘show_on_front’) ) { // do something } Hint: You can append options.php to the WordpPress admin url like this: http://www.example.com/wp-admin/options.php to see all options. ( that’s where I found the answer for you .)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)