Is template name always same as directory name?

According to the codex The Template is the directory name of the parent theme … If you want to make a child of a theme with the directory name example-theme-name, then you would use Template: example-theme-name. So yes its always the name of the parent theme directory.

Can I have both front-page.php and index.php?

When a theme has the front-page.php template, it will take over regardless of what you set in the admin pages to be your front page. 1 This means you have a couple of options: Create a page template with your loop and styles that are currently part of front-page.php, apply that template to a new page … Read more

Get URL of current post but not the page number

I don’t think your code works as expected because you are not printing the URL of the post. Note that get_permalink() returns the permalink of current post inside a loop but doesn’t print it like the_permalink(). So, you should use <?php echo get_permalink(); ?> or <?php the_permalink(); ?>.

Use one template only for custom post type archives?

add_filter( ‘template_include’, ‘wpsites_cpt_archive_page_template’, 99 ); function wpsites_cpt_archive_page_template( $template ) { if ( is_post_type_archive() ) { $new_template = locate_template( array( ‘your-cpt-template.php’ ) ); if ( ” != $new_template ) { return $new_template ; } } return $template; } Try this in your functions file. You can add your post types to this line like this: if … Read more

Different templates for same content, landing page from different URLs (generic, simple)

I don’t know what your definition of “simple” is, so not sure this qualifies. It’s not really a simple task to do this dynamically. First, we register a new query var to pass the alternate identifier: function wpd_portfolios_query_var($query_vars){ $query_vars[] = ‘portfolio_key’; return $query_vars; } add_filter(‘query_vars’, ‘wpd_portfolios_query_var’); Next, we add a rewrite rule to handle incoming … Read more

How to get link to homepage

echo esc_url( home_url( “https://wordpress.stackexchange.com/” ) ); this best practice. get_bloginfo( $show, $filter ); It has lots of Parameters to get info so let see the ##SHOW(Parameters): name,description,wpurl,url,admin_email,charset,version,html_type,text_direction,language,stylesheet_url,stylesheet_directory,template_url,pingback_url,atom_url,rdf_url,rss_url,rss2_url,comments_atom_url,comments_rss2_url,siteurl,home so if you want to use this finction you have to use like get_bloginfo(‘wpurl’); or get_bloginfo(‘url’); These two functions home_url() and site_url() return the same value (WordPress address … Read more

Display current category and child

$current_cat_id = get_queried_object_id(); $kids = get_terms([ ‘taxonomy’ => get_queried_object()->taxonomy, ‘parent’ => $current_cat_id, ]); <?php $terms = get_terms([ ‘taxonomy’ => get_queried_object()->taxonomy, ‘parent’ => get_queried_object_id(), ]); echo ‘<div style=”height: 200px; text-transform: uppercase; border:1px solid #666666; padding:10px; overflow-y: scroll;”> <ul> foreach ( $terms as $term) { echo ‘<li><a href=”‘ . get_term_link( $term ) . ‘”>’ . $term->name . … Read more

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