How do I get the trackback count of a post in wordpress without writing an SQL query?

You can specify what kind of comment you want to retrieve using get_comments(). // Assumes you’ve set $post_id somewhere. $args = array( ‘type’ => ‘trackback’, ‘post_id’ => $post_id, ); $trackbacks = get_comments( $args ); $trackback_count = count( $trackbacks ); Edited to add: As Sally CJ points out in the comments, you can do this in … Read more

How to support letting users add their OWN logo to a custom theme?

You can create a basic theme options page using the WordPress settings api Here is a simple example that will create an input field for the user to enter a path to the custom logo. // Add a menu for our option page add_action(‘admin_menu’, ‘prefix_myplugin_add_page’); function prefix_myplugin_add_page() { add_options_page( ‘My Theme Options’, ‘Theme Name Options’, … Read more

Multiple templates for single custom post type

Might be side-stepping your question, but can you use get_template_part? <?php get_template_part( ‘plans’, get_post_meta($post->ID, ‘my_custom_field’, true ) ); ?> Then create “plans_plana.php” and “plans_planb.php” (assuming that ‘my_custom_field’ can have values of ‘plana’ and ‘planb’). twentyten and twentyeleven make heavy use of get_template_part if you need some more examples.

WordPress menu link doesn’t work properly

I guess you mean this link? <a class=”navbar-brand” href=”https://wordpress.stackexchange.com/questions/325734/<?php site_url(“home’); ?>”>Homee</a> Then I’m sure it won’t work on any other page than home. It’s because site_url() function doesn’t print anything – it returns its value. And don’t print it either. That means, that the link above is empty 😉 You should change it to this: … Read more

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