Tag Info

New answers tagged

1

Use pagename instead of page_id to query by slug. Note that if a page is a child of another page, pagename has to be the full parent/child path to the page, since slugs only have to be unique per-level in hierarchical post types. See WP_Query for the full list of query vars.


0

You can try selecting the $post_id where $page_name = $page_name


1

There are many wordpress plugins which are not written correctly. Or some plugins are written for old version of wordpress. Please test your plugins. One of them might be causing the problem. Please refer the steps indicated by @karthik for detailed testing.


0

Another safer alternative to this problem is using get_queried_object() which holds the current queried object to get the page slug which is held by the post_name property. This can be used anywhere in your template. $post can be used, but it can be unreliable as any custom query or custom code can change the value of $post, so it should be avoided outside ...


0

As per other answers slug is stored in post_name property. While it could be accessed directly I prefer the (underused) get_post_field() function for access post properties which have no proper API for them. It requires post provided explicitly and doesn't default to the current one, so in full for current post it would be: $slug = get_post_field( ...


0

I see three options here, but before I start, just a few notes on your code Do not use $wp_query as your query variable. This is the global query variable used by the main query which also holds the main query object. The way you have used it breaks the main query object and sets your custom query to it. You should avoid this method at all times as many ...


0

In your page.php or single.php whichever is concerned here. After the post title code, add this: <?php the_post_thumbnail(); ?> Additional modification can be found in Codex


0

Change your query code to this: add_filter( 'post_limits', 'my_post_limits' ); // The Query $wp_query = new WP_Query( $args ); remove_filter( 'post_limits', 'my_post_limits' ); In your theme/functions.php, add this: function my_post_limits( $limit, $query ) { return 'LIMIT 0, 30'; }


1

It looks like problem is coming from any of installed plug in or your theme. Backup your database. Switch to default wordpress theme. If problem disappears, your theme is the culprit. If problem still exists, Deactivate all installed plugins. If problem disappears, activate plugins one by one and see which plugin causes the error. If problem still exists, ...


0

please try this for latest pages. <?php $args = array( 'post_type' => 'page', 'posts_per_page' => 10, 'category' => '', 'orderby' => 'date', 'order' => 'DESC', ); $data = get_posts($args); print_r($data); ?>


2

Try the code below. This is the Reference: WP_Query <?php $args = array( 'post_type' => 'page', 'posts_per_page' => 10, 'category_name' => 'mycat', 'fields' => 'ids' ); $data = get_posts($args); print_r($data);


1

You can use get_post_field() for getting the post fields i.e. Title, Content etc. // Replace $post_id with the ID of your post/page <?php get_post_field( post_title, $post_id); get_post_field( post_content, $post_id); ?>


1

you can try a code like this <?php function theme_settings_init(){ register_setting( 'theme_settings', 'theme_settings' ); } ├« This is used to reserve a name for a custom settings array //Add settings to page menu function add_settings_page() { add_menu_page( __( 'Contenu ├ęditable' ), __( 'Contenu ├ęditable' ), 'manage_options', 'settings', ...


0

#sidebarSubnav h3 is not letting your Custom CSS to work since it already contains !important for its style properties. Place your code below the above selectors or load the custom css file after the default stylesheet.


0

got it working now... I added a counter $i = 0; $childnum = count($children); just after the if statement of the children. & added this code if ($i == $childnum - 1) { $output .= '<div class="viewmore">'. $viewmore .'</div>'; } $i++; after the the code: $output .= '<div ...


0

You can customize the look and feel for a specific page within the same theme using some of these methods (maybe more): Use a dedicated template for specific pages. For example, if the ID of your page is 45 you can create a template with the file name page-45.php. See template hierarchy. Use a reusable page template. See page templates in Codex. Use the ...


0

Pages are an independent entity separate from whatever theme is active at that moment. This is the design paradigm of most CMS systems that separate the concerns of site content from the view or rendering layer which allows a site owner the chance to change how his site looks without having to worry about the contents. HOWEVER, it would theoretically be ...


0

I had to modify the permalink configuration which was set on www.mydomain.com/index.php/%.... Just deleted the index/php and it worked


0

There are multiple ways to go about this, but one way I would consider if I were you would be to do it like this. On the index.php or whatever page the posts appear on do the following three times each with different categories: $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $arguments = array( 'category_name' => 'category' ...


0

Ok, I've solved the problem. There was a wrong parameter that cause an error on this specific select. The strange thing that just this select was affected. I needed to increase sort_buffer_size and be careful with max_sort_length. []'s Emanuel


3

If you want to add your own tags to WordPress pages use the wp_head action. To modify or remove <head> elements being added by Yoast you'll need to use the filters they provide. As documented in that link you can modify the page title, author, keywords and more.


0

It's because of the extra class row wrapped. After the container class <div class="container"> Remove this code of class row <div class="row"> and also remove the extra closing div if added for it. The sidebar will be positioned to the right side.


2

Whenever you add a new item to WordPress Menu ( Appearance -> Menu ) it creates a new Post of Post Type nav_menu_item and gets assigned a post meta called _menu_item_object_id with the main Post ID. For example, if I create a page called "Home" it gets assigned a Post ID of 2. Now, when I go to Menus and add the page to a menu, WordPress creates a new ...


3

You are accessing your hosting server panel. There is no way you will find Appearance tab there. Go to this URL: http://yourdomain.com/wp-admin to access your WordPress Dashboard. You can view the Appearance section there.


-1

Try to use include("footer.php"); And I see your <div id="content" class="snap-content"> didn't have close tag </div>


1

I've modified your code a little to check that the post type is a page, that the current user can edit that page, verify the nonce and verify the inserting attachment functions. The resulting code is working. It seems that don't checking the post type could be the reason of the issue. Also, you don't need to manually include 'wp-admin/includes/image.php': ...


-1

Part of your problem might be that while you create a nonce you don't really use it. You don't really need it to be a nonce, an hidden text input will be as good (yes, codex is wrong again ;) ). You use the hidden input as an indicator to when the save happened from the post edit screen, or technically when the meta box was displayed as part of the form. ...


0

This worked for me: function hide_editor() { if(isset($_REQUEST['post'])){ $post_id = $_REQUEST['post']; $template_file = get_post_meta($post_id, '_wp_page_template', true); if($template_file == 'page-home.php'){ // template name here remove_post_type_support('page', 'editor'); } } } add_action( 'load-post.php', 'hide_editor' ); ...


1

Change Settings -> Permalinks to Post Name. Go to your page and edit the Permalink field below the title field.


0

I believe your best solution will be to setup postdata and the making use of the the_content() template tag $post = get_page_by_title( 'About us' ); setup_postdata( $post ); ?> <p> <?php the_content(); ?> </p> <?php wp_reset_postdata(); ?>


2

You need to add the following code to content-page.php in your theme folder. <?php the_author(); ?>


1

If I have understood correctly you should be able to edit your page template to include the below. I'm not sure on any plugin to do this though. More info: https://codex.wordpress.org/Function_Reference/get_the_author <?php $author = get_the_author(); echo "$author"; ?> ** This is untested


0

The plugin you're looking for is Buddypress! With Buddypress you can have member profiles, activity streams, user groups, messaging, and more. With this plugin you can create a specific field or textarea called CV that will be outputed on the user's profile pages, this way your users can fill their CV by themselves. If you're looking to just create pages ...


1

I vote for having two separate pages since this gives you all the power of permalinks that go directly to a specific video. That's much better for you and your visitors since the content can be more easily shared. From the codes perspective, you can apply DRY principles and still use a single-video.php and archive-video.php template. Have a look at the ...


0

The add_filter followed by remove_filter approach seems hacky, I prefer using a conditional approach like this: /** * Post type archives by month */ function kevinlearynet_getarchives_events( $sql_where, $r ) { // conditions for when you want to do this // (don't do it all the time) if ( is_post_type_archive( 'event' ) ) { $sql_where ...


0

You just need to hook into the filter like this and replace 0 with a time calculation, like time() + 60 function set_cookie_expire () { echo 0; } add_filter('post_password_expires', 'set_cookie_expire');


0

In save_post action you can access to the objet of the saved post and check the post type before tagging it: add_action( 'save_post', 'add_authors_name', 10, 2 ); function add_authors_name( $post_id, $post ) { // The post types you want be tagged to $valid_post_types array $valid_post_types = array( 'post', 'community' ); if( in_array( ...



Top 50 recent answers are included