How do I find PHP file that contains content of my page?

You are under a fundamentally wrong assumption: The content you input via the administrative back-end does not live in a file, but in the database, specifically in the wp_posts table. Do not be misguided by the table’s name, a “page” is technically a post of type page. If you attempted to find the content you … Read more

Proper way to replace the_content only for pages created by custom plugin

You need to return the filtered content, try like this: add_filter(‘the_content’, ’emd_content’); function emd_content( $content ) { if ( is_page(‘Member Directory’) ) { include dirname( __FILE__ ) . ‘/content-members.php’; } elseif ( is_page(‘Contact Members’) ) { include dirname( __FILE__ ) . ‘/content-member-contact-form.php’; } else { return $content; } } But the better way is to … Read more

get_the_title() gets printed out twice

Your conditional is always true. To understand why, consider what happens in this function when there is no post parent: function get_top_ancestor_id() { global $post; // no parent so this doesn’t run: // if($post->post_parent) { // $ancestors = array_reverse(get_post_ancestors($post->ID)); // return $ancestors[0]; // } return $post->ID; } Which simplifies to: function get_top_ancestor_id() { global $post; … Read more

Custom page template for multiple pages

You can always make use of the page_template filter to tell WordPress to use a specific page template for all child pages of a certain parent. It is as easy as creating a special page template, lets call it page-wpse-person.php. Now it is as easy as including that template whenever a child page of people … Read more

Get the ID of the direct parent page

I’m assuming that you’re asking how to do it with code? (Doing it in backend is pretty easy – just try to edit parent page and see the ID in URL). So how to check post parent in code? It’s also very easy – direct parent is stored in post_parent property. If post has no … Read more

Hooking into the post editing screen for an existing page only

You should really only need to run this on an existing post, since new posts will be created in the manner you specify. add_action( ‘load-post.php’, ‘custom_content_conversion’ ); function custom_content_conversion() { if (! empty($_GET[‘post’]) ) { // Get the post object $post = get_post($_GET[‘post’]); // If the post object has content, store it in the meta … Read more

Pass data from one page to anothe file/page in wordpress

You can try to use functions.php to handle the form submission and send the data via AJAX. Add a hidden field in your form with the action to be taken (on functions.php): <input type=”hidden” name=”action” value=”save_contact”/> In you footer.php add the jQuery code to handle the AJAX request: jQuery(‘#your-form’).submit(ajaxSubmit); function ajaxSubmit(e){ e.preventDefault(); var formData = … Read more

Role can edit just one page [closed]

Adminimize does not remove menu items etc, it just keeps them visually hidden. In other words, your admin pages is still accessible. Add this code to your functions.php file: add_action(‘admin_menu’, ‘edit_trustees_page’); function edit_trustees_page() { global $submenu; $trustees_page_id = 1; //change this value $url = get_admin_url() . ‘post.php?post=” . $trustees_page_id . “&action=edit’; $submenu[‘index.php’][] = array( ‘Edit … Read more

Updated WordPress, now getting errors on site

I suspect this is already resolved in the plugin, but I added a check for the new function in wp-content/plugins/fusion-builder/shortcodes/fusion-image.php:285. if ( ! empty( $image_id ) && function_exists( ‘wp_image_add_srcset_and_sizes’ ) ) { $content = wp_image_add_srcset_and_sizes( $content, wp_get_attachment_metadata( (int) $image_id ), $image_id ); } elseif ( function_exists( ‘wp_make_content_images_responsive’ ) ) { $content = wp_make_content_images_responsive( $content ); … Read more