writing posts in indian regional language (Punjabi)

If you want to install WordPress and use it in Punjabi, there is an ongoing effort to localize WordPress into Punjabi; see https://make.wordpress.org/polyglots/teams/ The support forums in Punjabi are not yet complete: https://pan.wordpress.org/ I tried using the Google Translator plugin, but that does not convert the page accurately. Google Translator is machine translation, not human; … Read more

Custon Content within WordPress Loop

You can use current_post field of WP_Query to check inside the loop, or you can break the loop in two loops. Here are code samples: <?php $services_loop = new WP_Query( array( ‘post_type’ => ‘service’, ‘posts_per_page’ => -1 ) ); while ( $services_loop->have_posts() ) : $services_loop->the_post(); ?> <section class=”single-service”> <div class=”container”> <div class=”row”> <div class=”col-md-6″> <?php … Read more

Where is the right place to store custom images?

WordPress has a core function wp_upload_dir that return info for the current upload folder. Using this function you can retrieve all info on uploads folder base on current configuration. E.g. if you set WP_CONTENT_DIR and/or WP_CONTENT_URL or UPLOADS constants that function will return the direcory according to this settings. If you have checked the option … Read more

Run plugins only on certain pages

I want to load content from another table into wp_posts and then show it as a normal page. What solution do you recommend. If that’s your goal, then use shortcodes! For example: // PHP code add_shortcode( ‘footag’, ‘wpdocs_footag_func’ ); function wpdocs_footag_func( $atts ) { return “foo = “.$atts[‘foo’]; } Then in your content: [footag foo=”bar”] … Read more

Custom post.php

To remove Preview Button function posttype_admin_css() { global $post_type; $post_types = array( /* set post types */ ‘post_type_name’ ); if(in_array($post_type, $post_types)) echo ‘<style type=”text/css”>#post-preview, #view-post-btn{display: none;}</style>’; } add_action( ‘admin_head-post-new.php’, ‘posttype_admin_css’ ); add_action( ‘admin_head-post.php’, ‘posttype_admin_css’ ); To remove slug function vipx_remove_cpt_slug( $post_link, $post, $leavename ) { if ( ‘post_type_name’ != $post->post_type || ‘publish’ != $post->post_status ) … Read more