Customizing Item / Single Post Template

Hello!

I’m using Tainacan as a module on a pre-existing site that uses a non-compatible theme (inkblot). I’ve looked through the documentation on how to make a compatible child theme as well as custom templates. I’d like to tinker around with it and see if I can manage to make some tweaks to how items (single posts) appear.
Is there anywhere I can find more detailed instructions on what files I need to create and where? I’m not a developer, so I can’t fill in some of the steps I’m sure are obvious to others.
For example, the custom templates page says " To put it simply, you need .php files equivalent to the ones that Tainacan plugin registers by default." Are these something I create locally on my computer and then add to my wordpress installation? Or can I create them directly within my installation? I assume they need to be added to my theme’s files. Under what folder?

I understand this is a bit out of the scope of Tainacan-specific help, but any links or resources would be appreciated!

Hello @phantomdoodler!

Our documentation in fact goes more deep into customizing the Archive template, the Single is less explained.

Ideally you would create a child theme. But you can also edit the files directely in your theme. You would need a file called single-items.php inside a tainacan folder inside the theme root folder. In this file, you’ll be able to call our template tags to render the elements that you desire for the item template. Take a look at the source code of Tainacan Interface to have an idea:

It actually loads more files from there but if you look at their code things are quite simple. You’ll call functions like: the_title(), tainacan_the_item_gallery() and tainacan_the_metadata_sections().

Thank you! Can I do this from inside Wordpress? Or do I have to go through my host to access the theme root folder?

In Wordpress, I only see ways to edit existing theme files:

I did look into creating a child theme, but I had much the same problem. All the guides I can find start with steps like “create a child theme folder” with no details on where I’m able to do that or how:

Worpress keeps going more and more WSIWYG-focused, so it’s entirely unclear how I can even access the directories to begin with.

I’m sure it will make much more sense once I can actually play around with the code itself, but I don’t have the basic context for how to get that far, which I’m sure is common-sense to developers :')

You would need access to the server folders to create any file there. Even via the admin theme file editor, they won’t allow uploading directly a file because it would be a security risk.

As you mentioned earlier, this is the kind of thing that is supposed to be done by someone who understands more about the internals. While we do explain how to do it (the child theme would simply be a folder inside the wp-content/themes directory of your server) I don’t recommend going ahead if you are not experienced with this. Specially because if you pass a wrong parameter or call a function that does not exists, it would break your website and you would lose access to some areas of it.

So if you don’t feel sure with this instructions, my main suggestion would be to install and active a theme that does offer support. Blocksy with our integration plugin, for example, seems to be easily customizable to achieve any of those layouts that Inkblot offers (not to mention this theme is very old and may contain security or compatibility issues with more recent WordPress and plugins). I understand it is a pre-existing site, but adapting whichever widgets and customization that were made there seems more easy to me than digging into installation folders without knowledge. :thinking:

I was able to locate the directory! I had to log into my host’s cPanel through my webhost and open the file manager. The files I needed were stored under public_html > wp-content > themes for me.

I have a staging site and a backup, so I figure I won’t know if it’s something I can handle until I give it a try. Cheers!

1 curtida

For posterity (and anyone else looking for this info):

I was able to keep my current theme while customizing how posts (single-items.php) appear!

Here’s what I did:

  1. I download the example Tainacan child theme from Github.
  2. Using CPanel’s file explorer, I located my theme files (home > public_html > wp-content > themes > [theme name])
  3. In the theme folder, I created a sub-folder named “tainacan”
  4. I uploaded the four .php files from the downloaded childhood theme to this folder.
  5. Then, I found my theme’s existing function file (home > public_html > wp-content > themes > [theme name] > functions.php)
  6. I copied the “Enqueue scripts and styles” section from the downloaded child theme’s “functions.php” file and pasted it into my theme’s existing file.

And voila! I can now edit single-items.php as well as my existing theme’s css file to adjust how they show up on my site.

1 curtida