How do I make a wordpress plugin with menu item etc

If you want a frontend page you’ll have to create one with your plugin’s shortcode as the content. Then you display your plugin’s output in-place of that shortcode: /* Plugin Name: WPSE67438 Page plugin */ class wpse67438_plugin { const PAGE_TITLE = ‘WPSE67438’; //set the page title here. const SHORTCODE = ‘WPSE67438’; //set custom shortcode here. … Read more

Categories Template Assistance

Remove the cat parameter from your query and name your template file category.php From the WordPress Codex on Template Hierarchy; 1. category-{slug}.php – If the category’s slug were news, WordPress would look for category-news.php 2. category-{id}.php – If the category’s ID were 6, WordPress would look for category-6.php 3. category.php 4. archive.php 5. index.php The … Read more

custom single.php not working

Read Template Hierarchy article in the codex, especially pay attention to Single Post Display part. As you can see you have only three options: single-{post_type}.php single.php index.php It means that you can’t create a template for posts related to blog category. So you shouldn’t use single-blog.php template, use single.php instead and add there something like … Read more

Including text at the end of every post

You can try the the_content filter, to append/prepend text to the post content. Here’s a simple example: add_filter( ‘the_content’, function( $content ) { if( is_single() && has_tag( ‘follow-me-on-twitter’ ) ) { $content .= ‘<div>Like my posts? Follow me on twitter!</div>’; } return $content; }, 99 ); where we append the extra text if the current … Read more

Child theme TEMPLATEPATH issue

In your context you use the wrong constant. You must use the constant STYLESHEETPATH for the path to the active child theme. The constant TEMPLATEPATHget the path to the parent theme, that was referenced in the child theme. But, a important hint. The constant is deprecated, see the ticket #18298 for more information. That’s is … Read more

Adding variable to get_template_part

It looks like you’re just trying to concatenate a string, so it can be done like this: <?php get_template_part( ‘template-parts/component-page/component-‘ . $variable ); ?> Or you could use string interpolation (note the double quotes used here): <?php get_template_part( “template-parts/component-page/component-{$variable}” ); ?> Alternatively, get_template_part() can take two parameters, $slug and $name: <?php get_template_part( ‘template-parts/component-page/component’, $variable ); … Read more

Creating a wordpress plugin where users can override templates

You have to write it yourself. Check out the way WP e-commerce does it: First, the function to “register” the theme files. function wpsc_register_theme_file( $file_name ) { global $wpec_theme_files; if ( !in_array( $file_name, (array)$wpec_theme_files ) ) $wpec_theme_files[] = $file_name; } And then the function to find a theme file: /** * Checks the active theme … Read more

Show template loaded

The following will show the current template file to logged in admins only. If you add to the top of your functions file, you should see this info as the first line. add_action(‘wp_head’, ‘show_template’); function show_template() { global $template; global $current_user; get_currentuserinfo(); if ($current_user->user_level == 10 ) print_r($template); } You will still need to follow … Read more

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