Title: Style a permalink page
Last modified: January 11, 2020

---

# Style a permalink page

 *  [commanderk84](https://wordpress.org/support/users/commanderk84/)
 * (@commanderk84)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/style-a-permalink-page/)
 * I’m currently using permalinks to link to certain items on my WP-website.
    I 
   know it’s possible to use a style for posts in a query, or make page templates.
   But how is it possible to style a page that’s behind a permalink.
 * The code I use is:
    `<div class="theproject" style="background-image: url(<?php
   echo $feat_image; ?>);" onClick="location.href=' <?php the_permalink(); ?> ';"
   id="linkeddiv">`
 * When this is clicked, a page appears with a large featured images on top, then
   a h3 title and the page text.
 * Is it possible to give a kind of template in this code? Or maybe configure it
   within WordPress dashboard?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/style-a-permalink-page/#post-12315166)
 * For clarity, `permalink` is just a developer’s term for the permanent address
   of some content.
    I can’t tell if you are asking about the presentation of the
   page being linked to, or the page that contains the link. Are you writing a theme?
   Or are you writing content on your site?
 * The theme usually handles how each page is presented, and the content author 
   handles what the content looks like.
 * If you want to change how the pages are shown, you should change your theme, 
   or make a child theme to add some CSS or functions to present things differently,
   or just add CSS in Customizer > Additional CSS.
 *  Thread Starter [commanderk84](https://wordpress.org/support/users/commanderk84/)
 * (@commanderk84)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/style-a-permalink-page/#post-12315282)
 * I’m developing a new theme. I already was thinking it wasn’t really clear after
   in entered it.
 * I want to style te page that is opened when clicking a permalink. In my case 
   this is a post. I already got some pages/templates as a page.teplate-info.php(
   for example). Would it also be possible to style a certain category for posts?
 * Like I choose it belongs to the category ‘portfolio’, and than style the post/
   page that’s behind this category?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/style-a-permalink-page/#post-12315358)
 * There is not a post template hierarchy for assigned taxonomy terms, so you cannot
   do so with a certain template name with the default hierarchy. What you could
   do is output the category term slug in the single post’s body tag class. Then
   for certain predefined category terms specify certain CSS be applied which includes
   the body class in every applicable CSS selector.
 * For example, lets say you want to have an aqua background color for posts in 
   the category “foobar”. Your header.php template which outputs the body tag might
   in this specific case include the body tag attribute `class="post-template-default
   single single-post postid-2 foobar"`
 * Your CSS then could include the rule
 *     ```
       body.single-post.foobar {
         background-color: aqua;
       }
       ```
   
 * If you really need a specific template file be used for “foobar” category posts
   because the layout goes beyond CSS adjustments, you can use the “template_include”
   filter to override the usual template hierarchy that WP uses.
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/style-a-permalink-page/#post-12315905)
 * You should read about the [Template Hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/)
   so you know how the name of the template affects which one is selected for use.
   
   Page templates that you want the user to select for individual pages should not
   be named starting with `page-` because this is for pages with particular slugs.
 * You can make a template file for individual taxonomies (even to the term for 
   custom taxonomies).
    If you are writing a theme for distribution, you should 
   not have any template files with individual slugs, because of translation. Also,
   themes should not be handling custom post types or custom taxonomies, as they
   have to handle all content to display and don’t know the details of the custom
   post type or taxonomy. (Themes just display stuff, not create or define it.)
 * If you are writing a theme just for your own site, start with an existing theme
   and modify it. Don’t put custom types or taxonomies in it, because you need to
   be able to change themes later (especially if your site is hacked — the theme
   is often targeted since it is used on every page load).
 * One way a theme can treat different types of content uniquely is by using [post formats](https://developer.wordpress.org/themes/functionality/post-formats/).
   So if all of your portfolio category posts were marked as gallery post format,
   the theme can display them a certain way. Same for audio and video, etc.
 * You might want to read up on writing themes, in the [Theme Handbook](https://developer.wordpress.org/themes/).
 *  Thread Starter [commanderk84](https://wordpress.org/support/users/commanderk84/)
 * (@commanderk84)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/style-a-permalink-page/#post-12320865)
 * I solved it another way: by adding the wordpress-classes to the body tag. And
   then giving style to the class-items.
 * Thanks for your response for now!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Style a permalink page’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 3 participants
 * Last reply from: [commanderk84](https://wordpress.org/support/users/commanderk84/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/style-a-permalink-page/#post-12320865)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
