How to add a second content section when using certain page template

You could add a metabox for your second content section, then hide it with a bit of javascript if the current template isn’t a specific template: current_template = jQuery(‘#page_template’).val(); if( current_template != ‘my-special-template.php’ ){ jQuery(‘#_your_meta_box_id’).hide(); } then bind a function to the change event of the template dropdown and show it when a specific template … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)