How to give image source in wordpress page editor?

You can define constant in theme function file as: if( !defined(THEME_IMG_PATH)){ define( ‘THEME_IMG_PATH’, get_stylesheet_directory_uri() . ‘/site/images’ ); } and then you can use img tag as <img src=”https://wordpress.stackexchange.com/questions/252559/<?php echo THEME_IMG_PATH; ?>/footLogo.png” style=”padding: 0px!important; color:white”>

Using the Loop to show all levels of subpages under a parent page? Halfway there

Sounds like you’re looking for a recursive function, ie a function that calls itself. Here’s a rough outline of how it can be done: function wpse13669_show_all_children( $post_id, $current_level ) { $children = get_posts( array( ‘post_type’ =>’page’, ‘posts_per_page’ =>-1, ‘post_parent’ => $post_id, ‘order_by’ => ‘title’, ‘order’ => ‘ASC’ ) ); if ( empty($children) ) return; echo … Read more

Create pages automatically if they don’t exist

I think you want: if( get_page_by_title( ‘home’ ) == NULL ) create_pages_fly( ‘home’ ); Your original if condition said if the page exists (does not equal NULL), then create the page. Also, the 2nd argument should be a string, though it doesn’t really matter in this case since it’ll just default to ‘page’ anyway.

Strategy for handling hierarchical pages with empty parent content

I am using two strategies here… 1) is simple redirection to first child (using menu order) page-redirect.php <?php /* * Template Name: Redirector * Description: Empty Holder (redirect page) */ $rp = new WP_Query(array( ‘post_parent’ => get_the_id(), ‘post_type’ => ‘page’, ‘order’ => ‘asc’, ‘orderby’ => ‘menu_order’ )); if ($rp->have_posts()) while ( $rp->have_posts() ) { $rp->the_post(); … Read more

Disable visual editor on one specific page

In your code, calling the action admin_init makes is_admin() unnecessary. And, if not mistaken, is_page() is meant to be used in the front-end… But the solution is the following (based on this Answer): add_filter( ‘user_can_richedit’, ‘wpse_58501_page_can_richedit’ ); function wpse_58501_page_can_richedit( $can ) { global $post; if ( 28 == $post->ID ) return false; return $can; }

Password protect page with multiple passwords

Here’s just a demo test for fun, just to see if this might be possible: Demo First we set the post’s password, the usual way: Then we create a custom field called wpse_extra_passwords that takes comma seperated passwords: These are the extra passwords for that post. Let’s define the following helper function, based on the … Read more

What is an alternative to get_page_by_title()?

If you don’t force a title, and obviously do not know the id, the only way you can do it is by letting the user select which page to use, usually done in the theme’s options page, but can be done in the costumizer, or even as part of page editing

Post/Page Publish/Update button not clickable once I make an edit

It appears to be a bug, but one that can be hacked around each time it happens with about 2 seconds of work. This wordpress forum thread: If you’re using Chrome, right-click on the greyed-out “Update” button and select “Inspect Element”. You will see something to the likes of: <input name=”save” type=”submit” class=”button button-primary button-large … Read more

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