Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

0

index.php can be <?php //silent here. Doesn’t matter at the theme level really. Unless you want to guarantee something before your functions.php file it’s obsolete in the theme directory. Just like anything else in php/html on apache servers anyway.


0

Looks like they started with Gridder and used a jQuery plugin made by Orion Gunning. Here's the Github link with instructions. Here's a Demo with the markup. Here's a Demo without markup. You'll need to be able to work in the PHP template files with HTML, CSS, and Javascript to utilize this specific plugin.


0

As WebElaine said, it's common practice to create a Page Template in your theme and then create a page in your WordPress dashboard and select the template you just created. You can also create a PHP file in your theme and name it page-some-post.php and then create a page in your dashboard named Some Post.


1

You could accomplish this by setting up a redirect. If you're using an Apache server, for your example, you would add this to .htaccess above the WordPress block: RewriteEngine On RewriteRule somepost.php ^/somepost/ It's much more common, and recommended, to create a PHP file and a Page (or other post type) within wp-admin). This will still run all of ...


1

Well, I tested a lot of WooCommerce versions (3.3.x, 3.4.x and 3.5.x) using WP Rollback and I believe that was a error in e-mail templates that was fixed in version 3.5.2. I didn't found nothing in the changelog about that: https://raw.githubusercontent.com/woocommerce/woocommerce/master/CHANGELOG.txt Here is the template in WooCommerce in version 3.5.2: I ...


0

I am working today to upgrade my theme as per Jacob's earlier suggestion. I removed all the stylesheet links from header.php and put them into functions.php. The non-conditional stylesheets and those stylesheets which are connected using is_page_template() work without any issue. However, the stylesheets which are connected using is_category, is_tag, etc. ...


-1

This is very simple to do. Create a new PHP file in your theme root directory and add this to the top: <?php /* * Template Name: My custom view * Template Post Type: Post_typename // here you need to add the name of your custom post type */ ?> Full example will be as following: <?php /* * Template Name: My custom view * Template Post ...


0

Since 4.7 Custom Post Types have supported custom templates, just like Pages. So you could copy your theme's generic page template to a new template file, and add this to the top. <?php /* Template Name: Block editor template Template Post Type: my-post-type */ That will let you switch the template for your my-post-type post to a template that looks and ...


3

You can absolutely use the same variable names. Arguments like that do not pass through from one template to another without a little help from a function. So if in content-header.php you have $fruit = banana; and in content-body.php you have $fruit = apple; you will not have a conflict. Go nuts. Or bananas. ;)


0

Thanks for the help. I changed the code a little to work with the current WordPress version. Also changed it to support more than one custom template. I bet there is a better way of doing this but it worked for me. /** * Load Template with Plugin */ function yourname_add_page_template ($templates) { $templates['page-one.php'] = 'title here One'; $...


0

Another workaround that you could do is creating a widget of this paragraph. You will need to install a plugin as described in: How to Add WordPress Widgets in Post and Page Content You can now make a text widget of this paragraph and just add [do_widget paragraph] on all your pages where you want to show the paragraph. (the word paragraph in this example ...


2

The Template Hierarchy only covers what's listed here. So there is no filename you can give a template for it to be automatically used by default. However, it is possible to add your own logic to the template hieararchy with the page_template_hierarchy hook. So using this hook, you could check if the current page being viewed is the page that has been set ...


1

I am using the template file name in the section to load corresponding css files. For static-page.php I am loading static-page.css, similarly for single-post.php I would like to load single-post.css. As said, it is working fine on my static pages, but returns zero on single blog post page. This isn't really the correct way to do this. For starters ...


1

Don't redirect in templates to other templates. That's not how templates work. Notice in your browser that you're never redirected to single.php or front-page.php or anything like that. If you do this then if you load a page that uses index.php your browser is going to redirect to http://website.com/front-page.php and you'll get a 404. Templates are loaded ...


0

I don't see any reason to redirect index.php. Let's say you only have a Front Page, no blog or post types with archives. You would assign the Front Page in Settings -> Reading and WordPress will do the template redirect for you. At that point, nothing uses index.php and there's no need to redirect it. Maybe you install a plugin which create a post type and, ...


1

If you add sidebar-sidebaraleatorio.php and sidebar-sidebarrecomenda.php sidebar templates to your (child) theme directory, you can then call them with get_sidebar() function. Like so get_sidebar('sidebaraleatorio); and get_sidebar('sidebarrecomenda);. You can read more about sidebars from the Developer Handbook > Sidebars.


0

There can be multiple ways to achieve this, but creating a new template for each taxonomy/category is surely not the best. I will achieve this with a single template by using these two methods, You can pass the custom query variables while generating your dynamic pages or you can create a custom class that will loop through all categories, and adds ...


0

For achieve this title you need to extend get_the_archive_title . here is how or check the official doc function wpse64458_get_the_archive_title($title){ if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } return $title; } add_filter( '...


0

You can use get_the_category_list(), which returns a list of categories assigned to the post (each category in the list links to the category archive): printf( '<span class="posted-on">last updated on %1$s</span><span class="byline"> <i class="fa fa-user"></i> %2$s</span> in %3$s', sprintf( '<a href="%1$...


Top 50 recent answers are included