Internal Links to Pages in PHP?

Page Permalink from $id If you know the Page $id, use get_permalink(): <?php $permalink = get_permalink( $id ); ?> Page Permalink from $slug If you know the Page $slug, such as /about (including hierarchy, such as /about/work), use get_page_by_path() to determine the Page $id, then use get_permalink(). <?php $page_object = get_page_by_path( $slug ); $page_id = … Read more

Multiple areas of dynamic content in a page

The example you gave has a listing of three pages and four posts (which are dated). The same can be achieved by one of the following: two different Custom Post Types, one per block, e. g. post_type=”products” and post_type=”projects”; children of two another pages, e. g. children of “Products” in one block and children of … Read more

Notify admin when page is edited?

You can register TheDeadMedic’s function to fire on the save_post action, which runs every time a post is saved, regardless of whether or not the status changed. add_action( ‘save_post’, ‘__notify_admin_on_publish’, 10, 3 ); Then, comment out these lines in his function: //if ( $new_status != ‘publish’ || $old_status == ‘publish’ ) //return; To prevent getting … Read more

Change admin startpage to Pages-page?

This should work for you if you put it in your themes functions.php file, but you may want to modify the conditions, and the url to redirect to depending on your set up. function loginRedirect( $redirect_to, $request, $user ){ if( is_array( $user->roles ) ) { // check if user has a role return “/wp-admin/edit.php?post_type=page”; } … Read more

Custom SQL Query for WordPress page

The wpdb object can be used to run arbitrary queries against the WordPress database. Let’s say you want to list the most recent 4 posts: $results = $wpdb->get_results( “SELECT * FROM $wpdb->posts WHERE `post_type`=’post’ LIMIT 4” ); The $wpdb->posts variable will output the table name for posts. It’s usually wp_posts, but if you’re using a … Read more

Manual excerpts for pages not working on Search

You’re confusing “post type support” – which means enabling “feature” (and therefore MetaBoxes) for a post – with templating. Go into your theme, search for the search.php template in the folder. Add a Child Theme Add a file named search.php to your Child theme and copy/paste the content of your parent themes template file in … Read more

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