<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Ryvkin</title>
    <description>The latest articles on DEV Community by Michael Ryvkin (@gyrocode).</description>
    <link>https://dev.to/gyrocode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F27877%2F03270071-314e-4df4-b907-a3aac75ce3c7.jpg</url>
      <title>DEV Community: Michael Ryvkin</title>
      <link>https://dev.to/gyrocode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gyrocode"/>
    <language>en</language>
    <item>
      <title>5 WordPress interview questions</title>
      <dc:creator>Michael Ryvkin</dc:creator>
      <pubDate>Tue, 01 Aug 2017 20:55:22 +0000</pubDate>
      <link>https://dev.to/gyrocode/5-wordpress-interview-questions</link>
      <guid>https://dev.to/gyrocode/5-wordpress-interview-questions</guid>
      <description>&lt;p&gt;&lt;em&gt;See some WordPress interview questions below to sharpen your programming skills and practice.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Using the line numbers please describe what problems are preventing the following PHP/WordPress code from working properly as well as changes you would make to optimize this code to make it more efficient, if any.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?
class User {
   public function __get($username) {
      if(is_user_logged_in($username)){
         return 'valid';
      }

      return 'invalid';
   }
}

$e = new User();
if(empty($e-&amp;gt;checkinfo))
   $x = 0;

//Menu
for($i = 0; $i &amp;lt; 10; $i++) {
   echo '&amp;lt;ul id="'.$i.""&amp;gt;';
   for($j = 0; $j &amp;lt; 10; $j++) {
      if($x == 0)
         break

   echo '&amp;lt;li id=".'$j'."&amp;gt;Menu Item'.$j.'&amp;lt;/li&amp;gt;';
   }

   if($x =! 0){
      echo '&amp;lt;/ul&amp;gt;';
   }
}

/*Some more menu stuff here...*/
$options = get_option( 'theme-options' );
$colors = array('coral','toffee','sunshine','wildflower','wine');
$i = 0;
echo "&amp;lt;select name='theme-options[color]'&amp;gt;"
while($i &amp;lt; 5); {
echo '&amp;lt;option value="$colors[$i]"'. ((esc_attr( $options['color']== $color[$i])? 'selected="selected"': '' ).'&amp;gt;$colors[$i]&amp;lt;/option&amp;gt;';
$i++;
}
echo '&amp;lt;/select&amp;gt;';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Using JavaScript and jQuery please provide code that will remove placeholders in the template on page load to produce result shown below.
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Template:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="class-replace"&amp;gt;
   &amp;lt;p&amp;gt;
      &amp;lt;a href="http://[SITE].com"&amp;gt;[NAME]&amp;lt;/a&amp;gt; © [START]-[CURRENT]. All rights reserved
   &amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Expected result:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="copyright"&amp;gt;
   &amp;lt;p&amp;gt;
      &amp;lt;a href="http://foobar.com"&amp;gt;FooBar&amp;lt;/a&amp;gt; © 2011-2017. All rights reserved
   &amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. What does the following function remove from a WordPress users admin area?
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;remove_stuff&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;$actions&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;is_super_admin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;current_user_can&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;edit_theme_options&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;unset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$actions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;inline hide-if-no-js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;$actions&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;$actions&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;add_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;page_row_actions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;remove_stuff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;add_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;post_row_actions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;remove_stuff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  4. Some users find it difficult to insert media from a URL via the media uploader. Since 98% of our users don’t use that tab we would like to remove it. Please provide an example of how you would remove that tab for all users.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  5. Users who aren’t super admins or cannot edit theme options are not permitted to create new pages. Even with that capability removed, WordPress still shows the “Add New button. Please provide an example of how you would remove this button.
&lt;/h4&gt;

</description>
      <category>javascript</category>
      <category>php</category>
      <category>wordpress</category>
    </item>
  </channel>
</rss>
