{"id":172875,"date":"2013-03-15T12:17:03","date_gmt":"2013-03-15T08:17:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=172875"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=172875","title":{"rendered":"<span class=\"post_title\">\u0414\u043c\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d WordPress<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043f\u043e\u0441\u0442\u043e\u0432 \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445:  <\/p>\n<ul>\n<li> \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u2014 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043a\u0440\u0443\u043f\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0430\u043d\u043e\u043d\u0441, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/li>\n<li>\u041a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u2014 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"http:\/\/s41.radikal.ru\/i093\/1303\/e6\/348c18724f81.jpg\" alt=\"image\"\/><br \/>  \u041f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0442\u043e\u043c\u0443 \u0431\u044b\u043b \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u0438\u0445 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u2014 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0431\u0435\u0437 \u0430\u043d\u043e\u043d\u0441\u0430.<br \/>  \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0434\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432\u0438\u0434 \u0442\u0430\u043a, \u043a\u0430\u043a \u0435\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e. <\/p>\n<p>  \u041e\u0431\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:  <\/p>\n<ol>\n<li> \u041f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 style \u0432 \u0431\u0430\u0437\u0435<\/li>\n<li> \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043f\u043e\u0441\u0442\u044b \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435<\/li>\n<li> \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u0444\u043b\u0430\u0436\u043e\u043a \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f getPage<\/li>\n<li> \u0424\u0443\u043d\u043a\u0446\u0438\u044f getPage \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 <u>\u041e\u0416\u0418\u0414\u0410\u0415\u0422 \u0417\u0410\u0412\u0415\u0420\u0428\u0415\u041d\u0418\u042f \u041e\u0411\u0420\u0410\u0411\u041e\u0422\u041a\u0418<\/u><\/li>\n<li> \u0424\u0430\u0439\u043b style_updater.php \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0411\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li> \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f getPage \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443<\/li>\n<\/ol>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043c\u043e\u0451\u043c \u0441\u0430\u0439\u0442\u0435 \u2014 <a href=\"http:\/\/game.tobefun.org\/\">game.tobefun.org<\/a> (\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438)<br \/>  \u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0436\u0435 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c?<\/p>\n<h4>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0411\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u043b\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 wp-user \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u043f\u043e\u043b\u0435 &#8216;style&#8217; \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 1 \u0438\u043b\u0438 0. (\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 0).<\/p>\n<h4>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430<\/h4>\n<p>  \u0412 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043f\u043e\u0441\u043b\u0435   <\/p>\n<pre><code class=\"php\">&lt;?php if ( have_posts() ) : ?&gt; <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u0432\u0430\u0448 \u0446\u0438\u043a\u043b \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434  <\/p>\n<pre><code class=\"php\">&lt;?php $current_user = wp_get_current_user();     \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f   if ( 1 == $current_user-&gt;style ) {               \/\/ \u0415\u0441\u043b\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 style = 1  while ( have_posts() ) : the_post();            \/\/ \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0446\u0438\u043a\u043b get_template_part( 'content', 'min' );           \/\/ \u0413\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0443\u0434\u0443\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0430\u0439\u043b\u043e\u043c content-min.php endwhile; }                                      \/\/ \u0418 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u0446\u0438\u043a\u043b  else {\t                                         \/\/ \u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 style != 1 while ( have_posts() ) : the_post(); \t         \/\/ \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0446\u0438\u043a\u043b get_template_part( 'content', 'max' );           \/\/ \u0413\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0443\u0434\u0443\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0430\u0439\u043b\u043e\u043c content-max.php endwhile; }                                      \/\/ \u0418 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u0446\u0438\u043a\u043b  ?&gt; <\/code><\/pre>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 content-min.php \u0438 content-max.php<\/h4>\n<p>  content-min.php \u0438 content-max.php \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0434\u0438\u043d \u043f\u043e\u0441\u0442 \u0438 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0441\u0442\u043e\u044f\u0442 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"php\">&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt; &lt;div class=&quot;min&quot;&gt; &lt;h3&gt;&lt;?php the_title(); ?&gt;&lt;\/h3&gt; &lt;div class=&quot;image&quot;&gt; \t&lt;?php \t\t$thumb = get_post_thumbnail_id();                   \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 ID \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u0430 \t\t$img_url = wp_get_attachment_url( $thumb,'full' );  \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \t\t$image = aq_resize( $img_url, 170, 120, true );     \/\/ \u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 170\u0445120. \t?&gt; &lt;img width=&quot;170px&quot; height=&quot;120px&quot; src=&quot;&lt;?php echo $image ?&gt;&quot;\/&gt; \t\t&lt;\/div&gt;&lt;\/div&gt; &lt;\/a&gt; <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.  <\/p>\n<h5>\u0424\u0443\u043d\u043a\u0446\u0438\u044f aq_resize()<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435 \u0432\u0430\u0448\u0435\u0439 \u0442\u0435\u043c\u044b \u0444\u0430\u0439\u043b aq_resizer.php \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">aq_resizer.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  \/** * Title\t\t: Aqua Resizer * Description\t: Resizes WordPress images on the fly * Version\t: 1.1.3 * Author\t: Syamil MJ * Author URI\t: http:\/\/aquagraphite.com * License\t: WTFPL - http:\/\/sam.zoy.org\/wtfpl\/ * Documentation\t: https:\/\/github.com\/sy4mil\/Aqua-Resizer\/ * * @param string $url - (required) must be uploaded using wp media uploader * @param int $width - (required) * @param int $height - (optional) * @param bool $crop - (optional) default to soft crop * @param bool $single - (optional) returns an array if false * @uses wp_upload_dir() * @uses image_resize_dimensions() * @uses image_resize() * * @return str|array *\/  function aq_resize( $url, $width, $height = null, $crop = null, $single = true ) { \t \t\/\/validate inputs \tif(!$url OR !$width ) return false; \t \t\/\/define upload path & dir \t$upload_info = wp_upload_dir(); \t$upload_dir = $upload_info['basedir']; \t$upload_url = $upload_info['baseurl']; \t \t\/\/check if $img_url is local \tif(strpos( $url, home_url() ) === false) return false; \t \t\/\/define path of image \t$rel_path = str_replace( $upload_url, '', $url); \t$img_path = $upload_dir . $rel_path; \t \t\/\/check if img path exists, and is an image indeed \tif( !file_exists($img_path) OR !getimagesize($img_path) ) return false; \t \t\/\/get image info \t$info = pathinfo($img_path); \t$ext = $info['extension']; \tlist($orig_w,$orig_h) = getimagesize($img_path); \t \t\/\/get image size after cropping \t$dims = image_resize_dimensions($orig_w, $orig_h, $width, $height, $crop); \t$dst_w = $dims[4]; \t$dst_h = $dims[5]; \t \t\/\/use this to check if cropped image already exists, so we can return that instead \t$suffix = &quot;{$dst_w}x{$dst_h}&quot;; \t$dst_rel_path = str_replace( '.'.$ext, '', $rel_path); \t$destfilename = &quot;{$upload_dir}{$dst_rel_path}-{$suffix}.{$ext}&quot;; \t \t\/\/if orig size is smaller \tif($width &gt;= $orig_w) { \t\t \t\tif(!$dst_h) : \t\t\t\/\/can't resize, so return original url \t\t\t$img_url = $url; \t\t\t$dst_w = $orig_w; \t\t\t$dst_h = $orig_h; \t\t\t \t\telse : \t\t\t\/\/else check if cache exists \t\t\tif(file_exists($destfilename) && getimagesize($destfilename)) { \t\t\t\t$img_url = &quot;{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}&quot;; \t\t\t}  \t\t\t\/\/else resize and return the new resized image url \t\t\telse { \t\t\t\t$resized_img_path = image_resize( $img_path, $width, $height, $crop ); \t\t\t\t$resized_rel_path = str_replace( $upload_dir, '', $resized_img_path); \t\t\t\t$img_url = $upload_url . $resized_rel_path; \t\t\t} \t\t\t \t\tendif; \t\t \t} \t\/\/else check if cache exists \telseif(file_exists($destfilename) && getimagesize($destfilename)) { \t\t$img_url = &quot;{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}&quot;; \t}  \t\/\/else, we resize the image and return the new resized image url \telse { \t\t$resized_img_path = image_resize( $img_path, $width, $height, $crop ); \t\t$resized_rel_path = str_replace( $upload_dir, '', $resized_img_path); \t\t$img_url = $upload_url . $resized_rel_path; \t} \t \t\/\/return the output \tif($single) { \t\t\/\/str return \t\t$image = $img_url; \t} else { \t\t\/\/array return \t\t$image = array ( \t\t\t0 =&gt; $img_url, \t\t\t1 =&gt; $dst_w, \t\t\t2 =&gt; $dst_h \t\t); \t} \t \treturn $image; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0432 function.php \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435  <\/p>\n<pre><code class=\"php\">include ( 'aq_resizer.php' ); <\/code><\/pre>\n<h4>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439<\/h4>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 function.php \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c  <\/p>\n<pre><code class=\"php\">function change_posts_per_page( $query ) {  $current_user = wp_get_current_user();                     \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f      if ( is_admin() || ! $query-&gt;is_main_query() )          \/\/ \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441         return; if ( 1 == $current_user-&gt;style ) {                          \/\/ \u0415\u0441\u043b\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 style = 1         $query-&gt;set( 'posts_per_page', 30 );                \/\/ \u0412\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e 30 \u043f\u043e\u0441\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435          return; \t}   else {                                                    \/\/ \u0415\u0441\u043b\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 style != 1         $query-&gt;set( 'posts_per_page', 5 );                 \/\/ \u0412\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e 30 \u043f\u043e\u0441\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435          return;     } } add_action( 'pre_get_posts', 'change_posts_per_page', 1 ); <\/code><\/pre>\n<h4>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c \u0432\u0438\u0434\u0430<\/h4>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u0430 \u043f\u0430\u043d\u0435\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c  <\/p>\n<pre><code class=\"html\">&lt;input type=&quot;checkbox&quot;  &lt;?php if ( 1 == $current_user-&gt;style ) print 'checked';?&gt;    \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f  onchange=&quot;getPage(this)&quot;&gt;                                   \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0432 \u0448\u0430\u043f\u043a\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f  <\/p>\n<pre><code class=\"javascript\">&lt;script type=&quot;text\/javascript&quot;&gt; function getPage(obj) {   var style_statys = 0; if(obj.checked == true) { \tstyle_statys = 1; } else {  style_statys = 0; } \t\t$.post( \t\t\t&quot;style_updater.php&quot;,                     \/\/ \u0424\u0430\u0439\u043b \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST \t\t\t{ \t\t\t\tstyle: style_statys,                 \/\/ \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440. $_POST[style] \t\t\t\tID: &lt;?php print $current_user-&gt;ID; ?&gt;\/\/ \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440. $_POST[ID] \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \t\t\t}, \t\t\tonAjaxSuccess                            \/\/ \u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e onAjaxSuccess \t\t); \t} \tfunction onAjaxSuccess(_html) \t{ \t location.reload();                              \/\/ \u041a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442 \u043d\u0430\u0448\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \t} \/\/ --&gt; &lt;\/script&gt; <\/code><\/pre>\n<h5>style_updater.php<\/h5>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  include '..\/..\/..\/wp-config.php';\t\t\t\t\t\t\/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c wp-config.php $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); \t\/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0421\u0435\u0440\u0432\u0435\u0440\u0443 mysql_select_db(DB_NAME, $link);\t\t\t\t\t\t\/\/ \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 $query = 'UPDATE `wp_users` SET `style`='.$_POST['style'].' WHERE `ID`='.$_POST['ID']; \/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c SQL \u043a\u043e\u043c\u0430\u043d\u0434\u0443\t mysql_query($query, $link);\t\t\t \t\t\t\t\t\/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c SQL \u043a\u043e\u043c\u0430\u043d\u0434\u0443 mysql_close($link);\t\t\t\t\/\/ \u0417\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c ?&gt;  <\/code><\/pre>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/172875\/\"> http:\/\/habrahabr.ru\/post\/172875\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043f\u043e\u0441\u0442\u043e\u0432 \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445:  <\/p>\n<ul>\n<li> \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u2014 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043a\u0440\u0443\u043f\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0430\u043d\u043e\u043d\u0441, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/li>\n<li>\u041a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u2014 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"http:\/\/s41.radikal.ru\/i093\/1303\/e6\/348c18724f81.jpg\" alt=\"image\"\/><br \/>  \u041f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0442\u043e\u043c\u0443 \u0431\u044b\u043b \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u0438\u0445 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u2014 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0431\u0435\u0437 \u0430\u043d\u043e\u043d\u0441\u0430.<br \/>  \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0434\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432\u0438\u0434 \u0442\u0430\u043a, \u043a\u0430\u043a \u0435\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e. <\/p>\n<p>  \u041e\u0431\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:  <\/p>\n<ol>\n<li> \u041f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 style \u0432 \u0431\u0430\u0437\u0435<\/li>\n<li> \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043f\u043e\u0441\u0442\u044b \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435<\/li>\n<li> \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u0444\u043b\u0430\u0436\u043e\u043a \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f getPage<\/li>\n<li> \u0424\u0443\u043d\u043a\u0446\u0438\u044f getPage \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 <u>\u041e\u0416\u0418\u0414\u0410\u0415\u0422 \u0417\u0410\u0412\u0415\u0420\u0428\u0415\u041d\u0418\u042f \u041e\u0411\u0420\u0410\u0411\u041e\u0422\u041a\u0418<\/u><\/li>\n<li> \u0424\u0430\u0439\u043b style_updater.php \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0411\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li> \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f getPage \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443<\/li>\n<\/ol>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-172875","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/172875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=172875"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/172875\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=172875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=172875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=172875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}