Display content on Single page

Unless you have generated metafields called ‘home’, ‘about’, ‘contact’ and ‘services’ in functions.php using add_post_meta your calls to get_post_meta will always return false. So if you test if they are true later on, the answer is ‘no’ and nothing will be displayed.

Include template if a post is a single product

As Andy mentioned, you’re calling WCS_DIR, but that doesn’t exist. Updated the code to call WCT_DIR instead: define( ‘WCT_DIR’, plugin_dir_path( __FILE__ ) ); add_filter( ‘template_include’, ‘wdm_load_template’, 99 ); function wdm_load_template( $template ) { $template_slug = basename( rtrim( $template, ‘.php’ ) ); if ( ($template_slug === ‘single-product’ || $template_slug === ‘woocommerce’) && is_product() ) { $template … Read more

Add point on excerpt post

First of all return is used in PHP to return a value from a function. If you want to display something you need echo. Second, no excerpt is displayed in the lines you are pointing to. The excerpt is retrieved and then stored in a variable $myExcerpt. If you want to add … to the … Read more

How can I display a list of pages and the template used by each?

You could try this quick piece of code, it doesnt output to array though. $args = array( ‘meta_key’ => ‘_wp_page_template’, ‘sort_column’ => ‘post_title’, ‘sort_order’ => ‘desc’); $templates = get_pages($args); foreach ( $templates as $template){ $templatePage = $template->meta_value; $templateName = $template->post_name; echo “Named Template: {$templateName} – – {$templatePage}\n”; }

How can I make is_page_template() workable in child theme?

Your first version of no_sidebar_style() looks fine: function no_sidebar_style(){ if (is_page_template(‘page-templates/page-nosidebar.php’)) { wp_enqueue_style( ‘no-sidebar-style’, get_stylesheet_directory_uri().’/css/no-sidebar.css’); } } add_action( ‘wp_enqueue_scripts’, ‘no_sidebar_style’, 19); For debugging, you can use get_page_template() to see the name of the template you’re viewing.

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