title: Put php into a function to shortcut
body: <p>New to php, but I've learned how it works (I mean, I can write php and do the things in the YouTube tutorials). I'm having difficulty applying it to actual use though:</p>
  
  <p>I want to shorten the amount of php I need to put on <em>frontpage.php</em> (WordPress, but I hear this question is not a WordPress question; just a php one).</p>
  
  <p>I'm going to call the same php many times to display 1 post each time, just changing the category to display in the php - so, now I have:</p>
  
  <pre><code>lots of php cat=33 lots of php
  </code></pre>
  
  <p>I want to make a function so that on my frontpage.php, I just need to write:</p>
  
  <pre><code>whatever cat=33 whatever 
  </code></pre>
  
  <p>or just </p>
  
  <pre><code>whatever 33
  </code></pre>
  
  <p>If it helps to have my code, it is (this has tag, but I use both tag and cat here and there):</p>
  
  <pre><code>&lt;?php
              $args=array(
                'tag' =&gt; 'feature-left',
                'showposts'=&gt;1,
                'caller_get_posts'=&gt;1
              );
              $my_query = new WP_Query($args);
                  $offset = 3;
              if( $my_query-&gt;have_posts() ) {
              while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt;
                  &lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title_attribute(); ?&gt;" itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost"&gt;
                    &lt;h4&gt;&lt;?php the_excerpt(); ?&gt; &lt;/h4&gt;         
                  &lt;/a&gt;
                   &lt;a href="&lt;?php the_permalink() ?&gt;" &gt;
                 &lt;div class="front-first-article-title" itemprop="headline"&gt;&lt;h2 style="color:#00589C; margin-bottom:5px;"&gt;&lt;b&gt;&lt;?php the_title(); ?&gt;&lt;/b&gt;&lt;/h2&gt;
                  &lt;/div&gt;
                  &lt;?php
                  endwhile;
                  } //if ($my_query)
                      wp_reset_query();  // Restore global post data stomped by the_post().
  ?&gt;
  </code></pre>