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

Static front page displaying twice

Go to Dashboard -> Appearance -> Customize Click on “Theme Options” Now you can see your page sections that the second one is your first page that is repeated. Click on pencil icon at the top left of the unwanted section. Then on the list at the left you can see the name of your … Read more

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