What content to use for inserting images

Images (and other media) in WordPress are stores as attachments — which are a special native post type (more or less). There are two common ways to display attachments in a post context: Include them in post content (individually or via gallery shortcode) Select one as featured image (aka post thumbnail) and have theme with … Read more

wp-cli for Creating page-template

wp-cli is not a development tool, it is a server admin tool, as such all the scaffold stuff there is…. for lack of better word, unneeded bloat. It is unlikely to reflect best practice, especially if your copy is old. In the specific case of page templates, there is really nothing worth “scaffolding” the easiest … Read more

wp_redirect goes to infinity loop

Us this code instead: function redirect_location(){ global $wp; $current_url = home_url( $wp->request ); $UserDetails = unserialize(file_get_contents( ‘http://www.geoplugin.net/php.gp?ip=’ ) ); $userCountry = $UserDetails[‘geoplugin_countryCode’]; if($userCountry == ‘AR’){ $url = home_url(‘/ar/’); } else if($userCountry == ‘FR’){ $url = home_url(‘/fr/’); } else { $url = home_url(‘/in/’); } if( ( is_page() || is_home() ) && ( strpos( $current_url, $url ) … Read more

What is wrong with my page.php?

if i understand right the problem is that you assign a static $page_id = 98; so no matter what page you go to it will only display that page’s content. what you need is to use the WordPress loop so change your code to this <!– Start Page Content –> <h1 class=”blog-title”><?php the_title(); ?></h1> <?php … Read more

Is it possible to add a child post into the parent page?

First, you need to query the child Pages: $pageargs = array( ‘numberposts’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘post_type’ => ‘page’, ‘post_parent’ => $post->ID ); $childpages = get_posts( $pageargs ); Then, you need to create your custom Loop: foreach ( $childpages as $childpage ) { // Output whatever you want here, such as: … Read more

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