DIY میڈیا ہوم علامت

اپنے گھر تھیٹر اور ہائی فائی سیٹ اپ کے ڈیزائن اور پیدا کرنے کے لئے الٹی سائٹ.

1تبصرہ بلبلاjetpack کے بغیر jetpack کے طرز کے تبصرے

One of the best things about word­press is the built-in social aspect provided by com­ments. Get­ting your com­ment sec­tion right can be very import­ant to any web­site, includ­ing ours. Over the years we’ve exper­i­mented with vari­ous com­ment plu­gins includ­ing Dis­qus and more recently Jet­pack. How­ever, we’ve always ended up bring things back in house for man­age­ment, per­form­ance and pri­vacy reas­ons. When I moved back from Jet­pack com­ments I really missed some of the slick fea­tures provided by Jet­pack, both the social-net­work logins and the gen­er­al slick styl­ing. Any­way, to cut a long story short I finally had time today to take a good look at how word­press “does” com­ments and fig­ure out a way to build an in-house sys­tem which looks nice and slick like the com­ment inter­face provided by jet­pack. Best of all its sur­pris­ingly simple and does things the “prop­er” way…


First — to deal with the “social” aspect, I’ve resor­ted to a plu­gin called Word­Press Social Login کی طرف سے MiledThere are sev­er­al “social login” plu­gins, but this ver­sion (unlike the oth­ers) keeps everything totally in-house. It is a bit more work to con­fig­ure, but for the bene­fit to our vis­it­ors pri­vacy alone this is well worth it.

Next up was fig­ur­ing out how to change the built-in word­press com­ment form func­tion (fun­nily enough called comment_form()).  I’ll provide more detail later if any­one requests it, for now just find the rel­ev­ant code below…

comments.php (in theme folder)

[پی ایچ پی]
<!– You can start edit­ing here. –>

<?php if ( comments_open() ) : ?>

<sec­tion id=“respond” class=“respond-form”>
<?php comment_form(); ?>

<سکرپٹ>
document.getElementById(‘hidden-form-area’).style.display = ‘none’;
func­tion myFunction()
{
document.getElementById(‘hidden-form-area’).style.display = ‘block’;
}
</سکرپٹ>

</سیکشن>

<?php endif; // if you delete this the sky will fall on your head?>
[/پی ایچ پی]

functions.php کے (in theme folder)

[پی ایچ پی]
func­tion my_fields($fields)
{
$fields[‘author’] = ‘<p class=“comment-form-author”><input type=“text” name=“author” id=“author” size=“22” tabindex=“1” placeholder=“Name (ضرورت)” /></P>;
$fields[’email’] = ‘<p class=“comment-form-email”><input type=“text” name=“email” id=“email” size=“22” tabindex=“2” placeholder=“E‑mail (required — nev­er shared with any­one)” /></P>;
$fields[‘url’] = ‘<p class=“comment-form-url”><input type=“text” name=“url” id=“url” size=“22” tabindex=“2” placeholder=“Website” /></P>;
return $fields;
}
add_filter(‘comment_form_default_fields’,‘my_fields’);

func­tion remove_notice($defaults)
{
$defaults[‘comment_notes_before’] = ”;
$defaults[‘comment_notes_after’] = ”;
return $defaults;
}
add_filter( ‘comment_form_defaults’, ‘remove_notice’ );

func­tion remove_textarea($defaults)
{
$defaults[‘comment_field’] = ”;
return $defaults;
}
add_filter( ‘comment_form_defaults’, ‘remove_textarea’ );

func­tion add_textarea()
{
echo ‘<p class=“comment-form-comment”><textarea id=“comment” name=“comment” placeholder=“Enter your com­ment here…” onfocus=“myFunction()"></textarea></P><div id=“hidden-form-area”>;
}
ADD_ACTION( ‘comment_form_top’, ‘add_textarea’, 1 );

func­tion add_hideend()
{
echo ‘</div کے>;
}
ADD_ACTION( ‘comment_form_after’, ‘add_hideend’ );
[/پی ایچ پی]

اس مفید پایا? ہمیں بتائیں کرتے ہیں براہ مہربانی ذیل میں ایک تبصرہ چھوڑنے کے. آپ کے سبسکرائب کرنا چاہتے ہیں تو سب سے اوپر دائیں مینو پر لنک سبسکرائب استعمال کریں. آپ بھی ذیل سماجی روابط کا استعمال کرتے ہوئے کی طرف سے اپنے دوستوں کے ساتھ اس کا اشتراک کر سکتے ہیں. چیرس.

جواب چھوڑیں

ایک تبصرہ