• I am going to upload my theme tomorrow and I used underscores to build it. I have a lot of questions, so if anyone knows of a good web page on the topic then please share.

    1. In style.css _s there are references to underscores in the comments. Are you supposed to remove all of that but leave the lines about GNU?

    2. A lot of the other files have comments with * @link https://developer.www.ads-software.com/themes/basics/template-hierarchy/ and @package Tower (my theme name). CAn I remove all of that?

    3. I started from scratch for style.css – I did not use the stylesheet that came with underscores. But there is style-rtl.css. How do I generate that file for my stylesheet?

    4. When it comes to uploading my theme, do I just upload the folder with all the files in it from the admin area?

    Thanks and sorry for the newbie questions.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The link you gave as an example is the “good web page” on building a theme. (Theme Developer Handbook)

    1. If the comment makes sense for your version, you can leave it. Otherwise, remove it.

    2. Yes, you can remove it. But your theme should be child theme friendly, so consider what someone who is making a child theme needs to see.

    3. I find it easiest to put the RTL styles in the same file as the other styles, and remove style-rtl.css.

    4. Make a zip file that contains the folder exactly like you would get when you download a theme from www.ads-software.com. Name the folder with your theme’s slug and only include what is needed for running the theme. Then you upload the zip file.

    Thread Starter Jim

    (@kernix)

    As for #2, the theme is for me right now. I may make a child theme so that I have a generic theme to fall back on but I just want to see how it does for now.

    For #3, I’ll include rtl styles but how do I come up with them? Do I search for “right” and change to left? How do I do that?

    Thanks for letting me know about creating a zip file for the theme folder. I know the template tags page is really good but I have a lot more questions that are not getting answered on the subreddit. Like navigation and customizer.js – do I need those? Same with customizer.php or why target .current-menu-item doesn’t style the current page link. Anyway, thanks and this should get me started with my upload in the morning.

    • This reply was modified 3 years, 11 months ago by Jim.
    Thread Starter Jim

    (@kernix)

    By the way, I will be making ongoing changes to my theme for quite some time. How do I push an update to my theme? Do I just upload the new zip file? How do I get that theme update alert for my own theme or do I not need that. Will the upload of the new theme overwrite the existing one?

    For RTL, WP puts the rtl class on the body tag, so you can write any selectors you need using that. As an example, my theme puts a class on body when there is a sidebar, so I have this CSS:

    .has-sidebar .content-area,
    .rtl.has-sidebar.sidebar-leading .content-area {
    	float: left;
    	margin-right: 1.5%;
    	margin-left: 0;
    }
    .rtl.has-sidebar .content-area,
    .has-sidebar.sidebar-leading .content-area {
    	float: right;
    	margin-right: 0;
    	margin-left: 1.5%;
    }

    Also the sidebar itself can be on one side or the other, so I have this CSS:

    .widget-area {
    	float: left;
    	width: 25%;
    	position:relative;
    }
    .rtl .widget-area {
    	float: right;
    }

    Not all lefts and rights need special handling. You need to go through the CSS rule by rule and see if it needs something. There is a plugin called RTL Tester that is helpful for testing.

    Like navigation and customizer.js – do I need those?

    No one knows but you.

    Same with customizer.php or why target .current-menu-item doesn’t style the current page link.

    If you aren’t adding Customizer options, you don’t need the files for that. As for styling menus, the starter theme doesn’t do anything but give you an idea. The theme author has to write the styles for the menus.

    You won’t get it right the first time, so I suggest you develop the theme on a test site, best is local on your computer. When it looks good and won’t create a fatal error, then upload it to the actual site. As of WP 5.5, you can update from a zip file. Before that, you needed a plugin Easy Theme and Plugin Upgrades. The update alerts are only for themes in the WP repository.

    Thread Starter Jim

    (@kernix)

    You’re the best – thank you so much!

    Okay, I’ll do the rtl thing later by checking all my css, using the plugin, and seeing if body_class adds that.

    Since the theme is for me, I doubt I’ll be using the customizer but I’ll keep it anyway.

    As for the menu, I’m using wp_nav_menu and the classes that I see when I inspect the header. For some reason, my styles are not working for the current menu item but that is not a priority right now, just a nice style. I’ll look at that later.

    I am working on the theme in a local dev environment using xampp. So any updates to me theme is just a repeat upload of my zipped theme, correct? No need to reply if that is correct.

    I’m cleaning up the files now and will be uploading my theme soon (fingers crossed). Thanks again!

    Oh, one more thing but I could post a new question. I understand that changing the database prefix is recommended for security. I think I can do that on the initial install and that will take care of the tables and any fields in the table with wp_. I’ve seen examples of changing it to the following examples: wp_abc… or abc_ – does it matter which one I use? Keeping the wp_ and adding onto it to changing wp_ to my prefix like mine_? I’m going to try changing to abc_ or whatever during the install.

    Since the theme is for me, I doubt I’ll be using the customizer but I’ll keep it anyway.

    It is very handy to be able to change things without touching code.

    For some reason, my styles are not working for the current menu item

    The markup for the default fallback menu is slightly different than for the default custom menu.

    So any updates to me theme is just a repeat upload of my zipped theme, correct?

    Yes, but on a local test environment, you don’t even need to mess with zip files. You can edit the theme files directly. I thought you were uploading to the WP repository.

    I understand that changing the database prefix is recommended for security.

    Yes, this is unrelated to the theme. It is not really impacting security at all to change the prefix. You can use whatever you want when you install.

    Thread Starter Jim

    (@kernix)

    Am I supposed to upload to the repository? See this is why I wanted a link to a page that explains a lot of stuff. I have CSS specific to my header so if someone wanted to use my theme they would have to do a lot of CSS changes.

    If the database prefix is not a security thing then I won’t even bother changing it.

    Are you familiar with the underscores starter theme? There are some function names for entry header and entry footer content (date, categories, meta) and those functions are defined in template-tags.php. The tags are labeled as “Keywords” or maybe I changed it from “Tags”. Anyway, the tags and categories and the rest are outputting for the sample content I imported, but I am not seeing my Keyworfs\Tags outputting for the posts I created. Any idea why my keywords (tags) would not be output onto the page but they are for the sample content? I can live without that right now but there is something wrong and I would like to find the cause.

    Am I supposed to upload to the repository?

    No, the repository is for authors that want to share their themes. The themes are reviewed according to some requirements before being shown as available for other users.

    Are you familiar with the underscores starter theme?

    Yes, I have written an issue or two on that repository.

    I don’t know why your tags are not output. Did you create a different post type or taxonomy? Did you assign tags? Is the correct template(that calls the function) being used for output?

    Thread Starter Jim

    (@kernix)

    I don’t know why either but they showed up on my live site. XAMPP is working fine; I had a different enqueue_styles line so that I could see the updates while building the theme but that should only be for styles; I also had some plugins for debugging, showing the template file, and for viewing the database tables – maybe that last one. I would like to figure it out but my site is looking good – the 1 page I have styled.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Do I need to make any changes to if your theme is based on a starter theme?’ is closed to new replies.