Start with creating a child theme
http://codex.wordpress.org/Child_Themes
Suggest that you either write a plugin, or add some functions to your “functions.php” of your child theme.
This code will register a shortcode which will take parameters, the parameters being a list of images. The function invoked by the shortcode will fetch the current time, and output the html code to render one of the images, chosen according to the data/time.
Helpful details here: http://codex.wordpress.org/Shortcode_API
Hi Ross
Thank you for your reply but I’m afraid I do not understand a word of it π If I were able to program like that I would not be using WordPress at all.
Surely I can not be the first person to want to have an image change on the front page? Your reply suggests to me that either I am or everyone needs to re-invent the wheel and get a degree in programming every time they make a new page in WordPress which would be completely mental.
Is there no plug-in or widget or somesuch that can say ‘ok there are three photos flagged in the library, I will swap them round once an hour’ or something like that?
Your point is well made, it can be difficult here to judge the level of the conversation.
I searched the plugins for “random photo”, seems to be many choices (125).
Yes and i have tried at least half a dozen of them. Invariably they require a line in brackets [like this] in the text of the page and if I have correctly understood what is going on, you can not use html to position the photos cos all that would happen if you tried would be to position the code in the brackets and not the actual photos.
I hope I am not seen as venting my frustration on you when you are trying to help.
Many thanks
The phrase in square brackets ([like this]) are called shortcodes.
To place your randomised photo, you would locate a “TEXT” widget into the relevant part of your page, then put your shortcode into that widget area, controlling the placement of the widget will let you control the placement in a consistent fashion across your theme.
If you need clues on how the widget gets coded, use a browser inspector like firebug.
If you need extra control, you could put a div element round the shortcode, like this:
<div class="CustomRndPic">[shortcode]</div>
Ahaa! now we may be getting somewhere π
the code with the photo in is:
[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
<a href="http://www.liars.org.uk/wp-content/uploads/2014/10/bs.png"><img src="http://www.liars.org.uk/wp-content/uploads/2014/10/bs.png" alt="bs" width="300" height="300" class="alignleft size-full wp-image-182" /></a>
are you suggesting that if I change that to:
<a href="http://www.liars.org.uk/wp-content/uploads/2014/10/bs.png"><img src=
<div class="CustomRndPic">[shortcode]</div>
alt="bs" width="300" height="300" class="alignleft size-full wp-image-182" /></a>
it might do what I am trying to get it to do?
I have just tried something similar to get the facebook icon to become left justified
<div align=”left”>
<?php DISPLAY_ACURAX_ICONS(); ?>
</div>
and it does not work
To put css inline you use the style attribute.
What you need is more like:
<div style='align:left;'>
<?php DISPLAY_ACURAX_ICONS(); ?>
</div>
or maybe ‘float:left;’
If you were using a browser inspector you would see that your changes are not being seen.
I tried it and it didn’t work, it put the icon there but it was still centre justified. I presume I was ment to put that in the header.php where I have been putting everything else?
Yes, put it into the header.php
What does your browser inspector tell you ?
I don’t know what the browser inspector says, cos I don’t know what it is π I am starting to think that the solution is to do with iframes, at least those half work. I have changed the Facebook thingy now and am able to left justify that but I can not get it to sit to the right of the twitter thing, whether that is because the twitter thing is overriding the settings, the iframes is buggy or i am doing it wrong I cannot say. I don’t suppose you fancy being the official webmaster for the National Association of Liars do you? It pays a billion quid.
Hi Ross.
Is there no room in the header widget area (I have never used the twentytwelve theme)
If there is you can add a text widget area there and paste your code inside there, much easier than editing the theme files etc…
there is nothing in the header.php that says widget, if that is what you are asking.