Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
WordPress theme file editing
I appreciate this is a complete long shot on a Textpattern forum but it’s doing my head in and I’m painted into a corner. All I am trying to do is tweak the CSS on a WordPress theme to change a few colours; something that would be a two-minute job on a Txp site.
The WP site is not using the GUI theme customizer as far as I can tell. All custom code is in theme files.
From the Appearance menu, I choose Edit Theme Files and accept the warning, which shows me a big list of all the site PHP and CSS assets. I click one, make changes, hit update file, it reports that the changes have been saved, but no amount of force refreshing or different browsers or incognito or anything will make the changes show on the website.
Digging into the rendered HTML, the stylesheet I have edited is called in with ?v=1.0.0
on the end of it. If I click that, it loads the original version, which is what the website is seeing. Presumably some sort of cache-helper feature? If I manually change the version number in the URL to anything else whatsoever – even ?v=wp-sucks
– my edited style sheet shows up, so it is clearly there in the file system, the changes have been committed, but something, somewhere is caching it or telling WordPress to load an old version.
I cannot find the file where it tells the WordPress internals which style sheet or version to serve; the equivalent of our txp:css tag. Index.php calls something called get_header()
which I presume loads header.php, but there’s nothing in that file that references the specific style.css file that I have changed. It must be another function somewhere buried deep that I have not yet found.
The theme I am editing is labelled as active. There are two other themes, including a child theme, that are both labelled inactive. All I get from searches is posts like “you shouldn’t edit theme files directly” or guides on how to do it from the GUI customizer, or greasy clickbait articles professing to be about how to do it, when all they really want is to sell you their plugin that does it better.
It’s got to be something obvious like a hidden Publish Theme button I can’t find. There’s no CDN involved. I don’t think the server itself is cacheing anything (though I don’t know for sure). There are no performance enhancing or cache WP plugins installed.
Has anybody any idea or clues on where I might poke around next? It’s baffling me.
Last edited by Bloke (2025-06-10 13:15:52)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#2 2025-06-10 13:55:45
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 576
Re: WordPress theme file editing
I’ve had to work with WordPress in the past and create stylesheets for it.
Inside your theme folder you should find a file called functions.php
. This is where your styles and other functions are included. WordPress uses this to know which stylesheet to load for the theme.
Usually your themes contents will be in wp-content/themes/<theme-name>
Here’s an example of a functions.php
file I created with comments. Your functions.php file will probably look different but hopefully it helps.
<?php
// enqueued items
// --------------
// register theme files
function theme_name_register_styles(){ // create the theme_name_register_styles function
wp_enqueue_style( // enqueue the stylesheet
'stylesheet_name', // stylesheet name
get_stylesheet_uri(), // url to the stylesheet
array(), // array of dependancies
'1.0', // the stylesheets version
'all' // the type of stylesheet (screen, print, etc.)
);
}
// load the theme files
add_action(
'wp_enqueue_scripts',
'theme_name_register_styles'
);
?>
—Edit—
Made the code look all purty like 🤩 (Thanks Bloke)
Last edited by Algaris (2025-06-10 15:14:13)
Offline
Re: WordPress theme file editing
Algaris wrote #339846:
Inside your theme folder you should find a file called
functions.php
. This is where your styles and other functions are included. WordPress uses this to know which stylesheet to load for the theme.
Bingo!
if (!defined('_S_VERSION')) {
// Replace the version number of the theme on each release.
define('_S_VERSION', '1.0.0');
}
...
...
function themename_scripts()
{
wp_enqueue_style('themename-style', get_stylesheet_uri(), array(), _S_VERSION);
}
add_action('wp_enqueue_scripts', 'themename_scripts');
I changed the version number in _S_VERSION
and boom the changes appeared. I feel less of a dunce now, thank you, thank you.
Annoyingly that does mean every time I make a singular tweak to any file to test another colour, I have to bump the version number to get it to show up, but what the heck.
You’ve just saved what little of my hair I have left. Thank you so much.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#4 2025-06-10 15:00:01
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 576
Re: WordPress theme file editing
No worries I’m glad to help. You’ve saved my skin numerous times before, even going above and beyond in your help.
It looks like your functions.php
is setup differently to mine. I set the version number and promptly forgot about it. Maybe if I ever do a major redesign I might bump it up a number.
—Edit—
Out of curiosity how did you get the fancy highlighted code block? I couldn’t figure out how to do that.
Last edited by Algaris (2025-06-10 15:05:10)
Offline
Re: WordPress theme file editing
I inherited this site and need it to limp along for the time being. Felt like a prize idiot in front of the site owner when I was making changes and nothing was happening!
Last edited by Bloke (2025-06-10 15:13:47)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: WordPress theme file editing
Algaris wrote #339848:
how did you get the fancy highlighted code block?
Use bc. php
then paste your code in the line beneath. It also accept txp
and html
(and maybe css
, can’t remember), among other syntax highlighters.
As usual, use bc..
if your code block contains empty lines, and then p.
to break out of it back to paragraphs.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: WordPress theme file editing
Side note: I’ve said it before and I’ll say it again: how on Earth did WordPress ever get to be the most prevalent CMS on the planet when it’s so appallingly hard to maintain sites, and so slow to use?!
When I was demoing the product builder in Txp, which has the same number of products as the existing website – as well as more functionality, on-the-fly image overlays (which WP doesn’t seem able to do), instant previews, and so on… all with a simpler interface than WP – he sort of blinked and said, “God that’s quick.”
😎
I tell ya, if we can crack e-commerce and unlimited custom fields (which go hand-in-hand), we’ll be a viable alternative to the big boys. Add on true multilingual content management, and we’ll surpass them in terms of features and power in a smaller, faster package.
My aim is to deliver all the above before I’m too old/dead to appreciate them.
Last edited by Bloke (2025-06-10 17:57:28)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: WordPress theme file editing
Bloke wrote #339851:
I tell ya, if we can crack e-commerce and unlimited custom fields (which go hand-in-hand), we’ll be a viable alternative to the big boys.
My aim is to deliver all the above before I’m too old/dead to appreciate them.
Amen to that, brother! And wishing you another 100 years. 😎
PS I am hanging on only so that I use unlimited custom fields
…. texted postive
Offline
Re: WordPress theme file editing
Thanks for hanging on! I know it’s been a long road, but as with all things Textpattern, it will be done right, with power and efficiency as key factors.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: WordPress theme file editing
Algaris wrote #339848:
Out of curiosity how did you get the fancy highlighted code block? I couldn’t figure out how to do that.
It is documented in the forum help page, linked next to the (your) username and the logout button at the top of this page. Check the heading “Displaying code blocks”
Bloke wrote #339851:
Side note: I’ve said it before and I’ll say it again: how on Earth did WordPress ever get to be the most prevalent CMS on the planet when it’s so appallingly hard to maintain sites, and so slow to use?!
And it is considered as the greatest thing since sliced water by some . My once-a-year visit to the backend of a WP site usually leads to a round of intense depression.
I tell ya, if we can crack e-commerce and unlimited custom fields (which go hand-in-hand), we’ll be a viable alternative to the big boys. Add on true multilingual content management, and we’ll surpass them in terms of features and power in a smaller, faster package.
My aim is to deliver all the above before I’m too old/dead to appreciate them.
Hope hope! Maybe I’ll live long enough to see it.
PS – maybe try first to release a Textpattern 4.9 some time soon?
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: WordPress theme file editing
phiw13 wrote #339854:
My once-a-year visit to the backend of a WP site usually leads to a round of intense depression.
Haha, I can definitely sympathise after spending a few weeks wading through the sluggish back-end mush.
maybe try first to release a Textpattern 4.9 some time soon?
Yeah it’s dragging on about a year longer than I hoped. *sigh*
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#12 Yesterday 08:05:58
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 576
Re: WordPress theme file editing
phiw13 wrote #339854:
It is documented in the forum help page, linked next to the (your) username and the logout button at the top of this page. Check the heading “Displaying code blocks”
Oooh. I completely missed that. I’ve been using the Textile link under the message field for help formatting my messages.
Bloke wrote #339851:
I tell ya, if we can crack e-commerce and unlimited custom fields (which go hand-in-hand), we’ll be a viable alternative to the big boys.
That would be amazing. If I may also add unlimited article categories to the list too. It’s something I’ve been waiting years for. I’m always coming up against the two categories per article limitation with every Textpattern site I work on.
The only other thing on my wish list would be an option to use Textpattern as a flat file CMS like Kirby or Statamic and completely drop the database entirely.
phiw13 wrote #339854:
My once-a-year visit to the backend of a WP site usually leads to a round of intense depression.
One of the ways I get around the horrible WordPress back end is to use the Advanced Custom Fields Pro plugin, thankfully I got it when they still used lifetime licences and not subscriptions. I use the plugin to strip out all the fields for a page or post and then setup templates of fields for specific purposes that I can assign to any page or post. Every page/post could have a different layout and fields if I want.
Offline