Look what count_user_posts()
does inside and change the post type parameter:
global $wpdb;
// 'page' is the important part here
$where = get_posts_by_author_sql('page', true, $userid);
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
Then you change your snippet to:
global $wpdb;
$user = wp_get_current_user();
$where = get_posts_by_author_sql( 'page', true, $user->ID );
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
if ( $count >= 1 ) {
// echo your text snippet
} else {
// echo your form
}
Related Posts:
- How do I count the number of pages a user has seen on my site, and force them to log in after a certain amount
- Allowing user to edit only certain pages
- How to display page title+link of page created by user
- Associate Page with User
- Show different badge based upon the user role
- Personal page for every user (not just authors)
- remove/hide pages from users backend
- List all private pages user has access rights to read
- Adding New Users to Your WordPress Site for edditign only one page
- How to create a page that lists all the experts(Users with same access permission as author)?
- Remove ID page from wp_count
- How to update the counter of private pages in the dashboard?
- New user Registration data imported into Page
- Role can edit just one page [closed]
- Author page like wordpress answers
- Custom user tables not working after migration
- When I enter password, I’m redirected to the WordPress login form
- Page view displays not properly after update wordpress
- Paginate Links not working
- Save search criteria per user and show on custom user page
- User profile in front-end
- How to set post slug when using wp_insert_post();?
- Create a page without adding a page in the Database
- What methods to use to create small, editable pieces of text for static pages?
- Hide page visual editor if certain template is selected?
- What is an alternative to get_page_by_title()?
- Add a new page to wordpress programmatically
- Get Permalink for the top level parent of child pages
- Get page id by title?
- disable password protected page for logged users
- How to embed page content in a blog post
- Notify admin when page is edited?
- How do I modify this page template to show subpage excerpts (not post excerpts)?
- foreach error on false boolean from get_terms
- How to get a feed for post type ‘page’?
- Multiple pages on a single page
- Overview with latest edited posts and pages
- WordPress post/page pagination (page links) to go back to the first section
- Export only pages and posts with mysql dump
- Backend option to include a javascript file on specific pages?
- Dashboard–> All Pages “How to create folders?”
- How to get the order attribute of a page
- Visiting Webpage ONLY after another page was visited. Possible?
- How do I pass data from page content to the underlying PHP template
- How to open a phpBB forum in the same website as sub-page [closed]
- Display page contain in index.php file
- How to redirect login and register pages
- Why do pages in WordPress have a hierarchy but menu’s also have a hierarchy?
- Text Editor Tags
- Custom page template with entirely different design. Is it possible in?
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- External stylesheet per page
- How to control who can view certain pages in BuddyPress? [closed]
- how to avoid the character conversion of WordPress pages?
- access control for assets in a website powered by wordpress
- How to remove only pages from Admin Bar?
- Query specific Pages
- Phantom page can’t get rid of/can’t get at to change
- ‘x’ Converted to html code in example: 5×10
- Published pages missing
- Getting ACF Field in Page – From the Footer
- How can I send an email when someone uses the HTML download Attribute?
- multiple post into single page
- Later blog post pages give 404 error
- Different css file not working for the page template I created
- How to change the order of the Front Page so it doesn’t appear first
- 404.php only works if I’m logged in. Everybody else redirects to wp-login.php – why?
- Using index.php as page template
- What’s the section of code (or loop) which retrieves the Page title and description?
- How to backup just pages from my site, but not posts with other post_type values
- Template field missing in page attributes
- How to hide a page in wordpress made for menu
- How to delete the scrollbar in my pages?
- How to make a page as default page for a theme without a plugin?
- How to change default home link title?
- Recovering a page from the drafts
- Pulling images from the media folder category to display inside a page
- My Password Protected Pages Aren’t Working
- Display grandchild page content on parent page
- Converting HTML to WordPress theme: integrating pages function and using its text editor, conditional enqueuing
- How do you assign custom template for Posts page (under Front page displays setting)
- Display custom_post_type with current taxonmy of a page
- Category Page Custom Layout [closed]
- How to copy specific page content and create child page?
- How to output different content of page on different places in my template
- WordPress slow pages/post, hangs and white text
- 1st Level Page with No Children
- Previewing Draft shows white page, publishing works fine?
- Changing title bar in browser window of theme “Encounters Lite”
- Custom Filter using meta_value in wordpress admin list not working
- making a pseudo-static page
- Dynamic content in pages
- Woocommerce – Making product pages child of shop
- Javascript will not run properly
- link a custom page into menu
- Website fully loads then immediately crashes in Internet Explorer [closed]
- How to display a page?
- How to read a page’s “Shortcodes” from the Template File?
- how to show Author post type count
- How can a user login on a wordpress page?