Articles of page template

Pagination for custom loop on custom page template is not displaying anything

I have created a page where user can see his favourite post which has been bookmarked by him get_user_favorites($user_id); This function is responsible for returning me all the favourite posts bookmarked by user in an array. I am using this approach to get the data from the database and make it work inside my Custom […]

Create a custom page template inside my wordpress plugin

I’m developing a WordPress plugin and I want to create a file to where I want to redirect the user to show some information. I know that a perfect solution for this is using WordPress custom pages. I’ve used it in the past and it was very useful. The problem is I can not use […]

wp_query on page template not working (Genesis framework)

I’m trying to use wp_query as part of a page template. The page is tagged with a taxonomy term and I’m trying to grab a list of posts that are also tagged with this taxonomy term. I’m able to grab the term itself from the page no problem, and use them as part of the […]

How to add custom template in plugin?

I want to add a custom template for a custom post (‘post_type’ => ‘matches’). I am writing a plugin.I keep my template in the templates/fp-fixture-template.php file. Here is the function: function fixture_template( $template_path ) { if ( get_post_type() == ‘matches’ ) { if ( is_single() ) { // checks if the file exists in the […]

How do I hide tinymce within the edit screen of a particular page

I have a page. The page is assigned a unique page template. The template will use a custom loop. This loop will not call the content of the particular page. I’d like to hide tinymce from the user. My preference would be to do this programatically, using a WordPress function rather then using css to […]

How to add pages in wordpress using codes?

I am trying to add wordpress pages using codes on theme activation. But the main problem is i cannot check whether the page with that particular slugs exist or not. Our code looks like this : add_action(“after_switch_theme”,function(){ if(is_page(‘all-post-list’)){ return; }else{ wp_insert_post([‘post_title’ =>’List Of All the Posts’,’post_status’=>’publish’,’post_name’=>’all-post-list’,’post_type’=>’page’,’page_template’=>’All Post List’]); return; } }); This hook is inserted […]

require_once not working

I have a custom page template, and this template need to include one php file. I tried to put this script require(‘…/hc-v2-child/ayah.php’) and this require(__DIR__.’ayah.php’); in functions.php and in the custom page template, but I’m getting this error [07-Oct-2015 04:15:21 UTC] PHP Fatal error: require_once(): Failed opening required ‘/folder/folder1/public_html/folde3/wp-content/themes/hc-v2-childayah.php’ (include_path=’.:/usr/php/54/usr/lib64:/usr/php/54/usr/share/pear’) in /folder/folder1/public_html/folde3/wp-content/themes/hc-v2-child/page-mylogin.php on line 51

Get_template_part seems to be ignoring my template

I am developing a website that requires specific pages to have certain elements change color in addition to a full-width calendar page. I figured that using page templates and changing what get_template_part looks for would be the simplest approach, but I’ve run into unexpected trouble. The page template loads fine, but the specific content template […]

Pages Become “Archive” Instead of Using Page Template

Update: After further inspection it appears that the pages that were effected are being created as “Archive” pages, but there is no archive.php file so they are using index.php. Why would my pages become archive pages when they have custom page-{slug} templates, and how do I fix this? (Earlier. . .) My theme was installed […]

Image not showing on page template in Twenty Fifteen-theme

I’m creating a custom template for a few of my subpages using the Twenty Fifteen theme. For some reason the linked image below won’t show, even though the url seems to be correct. I’ve started with page.php, renamed it and added these three lines of code below the #main opening tag: <?php if ( is_page( […]