1

I've built a custom WP theme. In the footer is a button to "download catalogue". The catalogue is a PDF created by the client which is periodically updated.

I'm looking for some pointers on a good way of achieving this:

Rather than expecting the client to upload the PDF to the media library, grab the link and change the button destination (or ask me to do it), I'd prefer it if they just had to go to a page in the admin panel and upload the latest catalogue and the button link updates automatically.

I'm thinking it probably should be a custom plugin, or a theme setting menu. A simple "upload file" button that then asks them to select the PDF on their computer.

I've does some initial searches but I'm hoping someone might offer up some suggestions of any existing functions or hooks etc that I could make use of (or an existing plugin it's lightweight).

Your help is much appreciated and will obviously save me a ton of time! Thanks in advance.

1

You could go with a plugin or just a theme options page that I believe is a better approach as you build a theme.

You could find more information about theme options page to the wordpress CODEX and the Customize API

You could use something like this add_settings_section( string $id, string $title, callable $callback, string $page ) more info here

  • 1
    Thanks for those links. Most useful. A bit more effort but much more elegant. I'll have a read. – Steviehype Nov 5 '17 at 9:42
  • This will allow you to have bigger control and also help you down the road of theme creation. – Drupalizeme Nov 5 '17 at 9:47
-1
  • Install Enable Media Replace.
  • Upload the PDF and link to it from your button.
  • When it needs to be changed, have the site owner 'replace' it.
  • That does seem simple and quick to set up! I'll take a look. Thanks – Steviehype Nov 5 '17 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.