Custom template not working for existing pages [closed]

as a solution, you can fully automate the selection of a template for a group of pages using slug names: add_filter(‘request’, function( $vars ) { $slug = explode(“https://wordpress.stackexchange.com/”, explode(‘?’, $_SERVER[‘REQUEST_URI’])[0]); array_pop ($slug); $temp_base = “…first_part_template_name…”; $temp_slug = array_pop ($slug); if (file_exists(get_template_directory().”https://wordpress.stackexchange.com/”.$template.’-‘.$temp_cat.’.php’)) { get_template_part( $temp_base, $temp_slug ); } }

add custom css on all page exept of one

add this to end of functions.php function mmk_enqueue_script(){ if( !is_page(123) ){ wp_enqueue_style(‘responsive-css’, get_stylesheet_directory_uri() . ‘/custom.css’, false); } } add_action( ‘wp_enqueue_scripts’, ‘mmk_enqueue_script’, 999); create a custom.css inside your theme directory. this CSS file will be applied to all pages except the one you specified. update “123” inside if condition with page id where you don’t want … Read more

Getting Custom Field value in WP_Query

You need to define the $post global variable if you want to access its ID property: function excateg($categ) { global $post; $recent = new WP_Query(“cat=$categ&showposts=1”); while($recent->have_posts()){ $recent->the_post(); $imageurl = get_post_meta($post->ID, ‘post-img’, true); } } Use it after the_post() because that function will set up that variable. Alternatively you can use the $recent->post property instead of … Read more

Complete Custom Style Part of Site

Open your theme functions.php. FTP/Server access: Navigate to your WP install and look in /wp-content/themes/[your theme folder] Via the WP Dashboard: Appearance > Editor, then look for Theme Functions (functions.php) in the right column Add the following to add a custom style sheet (replace “custom-style.css” with a better style sheet name, and replace ‘your-page-slug’ with … Read more

How do I include the sidebar (with Widgets) in a custom theme?

Your issue is the dynamic sidebar being called is not matching the ID of what is registered. Matching: <?php if ( is_active_sidebar( ‘sidebar-widgets’ ) ) : ?> <div id=”secondary” class=”widget-area” role=”complementary”> <?php dynamic_sidebar( ‘sidebar-widgets’ ); ?> </div><!– #secondary –> <?php endif; ?> Register Sidebar if (function_exists(‘register_sidebar’)) { register_sidebar(array( ‘name’ => ‘Sidebar Widgets’, ‘id’ => ‘sidebar-widgets’, … Read more

Why should I keep my personal WordPress separate from my “professional” one? [closed]

It really depends on who your target audience is… Keeping them together: Pros: It’s the real you. You won’t need to worry about what goes where. There’s always something (off topic) to blog about. Cons: Narrow-minded readers are exasperated by diversity. Especially if some of the topics you blog about can be controversial. (And narrow-minded … Read more

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