Note that there are some explanatory texts on larger screens.

plurals
  1. POImage above the title : Wordpress
    primarykey
    data
    text
    <p>I am trying to display the image (with class <code>coreimg</code>) above the title on wordpress (home page and single)<br> <code>coreimg</code> size : fixed (eg: 680 x 240)<br> I know I can do some css trick by relatively aligning them but I want a more sophisticated method. I also tried <code>get_first_image()</code> method by <a href="http://tipsforwordpress.com/wordpress/get-the-first-image-from-post/" rel="nofollow">westondeboer</a>. But the negetive point is -</p> <ul> <li>Can't fetch a specific image (with class <code>coreimg</code>), It has to be the first one.</li> <li>Its difficult to insert image's own <code>alt</code> or <code>title</code>. </li> </ul> <p>So what I'm trying to do is create a wp shortcode , which would be something like : </p> <blockquote> <p>[coreimg src="http://example.org/wp-content/uploads/2010/06/fly.jpg" title="The flying kite"] </p> </blockquote> <p>or even the below code would be fine :</p> <pre><code>&lt;img src="http://example.org/wp-content/uploads/2010/06/fly.jpg" title="The flying kite" alt="The flying kite" class="coreimg"/&gt; </code></pre> <p><strong>Update:</strong> The problem is just fetching the image through php. And I'm unable to do it, So I started over and hoping for a kick start for the code.<br> <strong>Update2:</strong><br> Current code in <code>single.php</code></p> <pre><code>&lt;h1 class="entry-title"&gt;&lt;?php the_title();?&gt;&lt;/h1&gt;&lt;?php the_content(); ?&gt; </code></pre> <p>New Code (should be like):</p> <pre><code>&lt;img src="&lt;?php get_coreimg_url(); ?&gt;" title="&lt;?php get_coreimg_title(); ?&gt;" alt="&lt;?php get_coreimg_title(); ?&gt;" class="headcoreimg"/&gt; &lt;h1 class="entry-title"&gt;&lt;?php the_title();?&gt;&lt;/h1&gt;&lt;?php the_content(); ?&gt; </code></pre> <p>Now Here I want <code>get_coreimg_url()</code>'s and <code>get_coreimg_title()</code>'s code for <code>functions.php</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload