Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
civicrm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plugins
civicrm
Commits
dfc6a77d
Commit
dfc6a77d
authored
9 years ago
by
Kevin Cristiano
Browse files
Options
Downloads
Patches
Plain Diff
PRERELEASE:CRM-18113 do not force "page.php" as basepage template from christianwach
parent
99b53093
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
includes/civicrm.basepage.php
+49
-6
49 additions, 6 deletions
includes/civicrm.basepage.php
with
49 additions
and
6 deletions
includes/civicrm.basepage.php
+
49
−
6
View file @
dfc6a77d
...
...
@@ -263,24 +263,67 @@ class CiviCRM_For_WordPress_Basepage {
/**
* Get CiviCRM base page template
* Callback method for 'template_include' hook, always called from WP front-end
* Get CiviCRM base page template.
*
* Callback method for 'template_include' hook, always called from WP front-end.
*
* @param string $template The path to the existing template
* @return string $template The modified path to the desired template
*/
public
function
basepage_template
(
$template
)
{
// use the basic page template, but allow overrides
// get template filename
$template_name
=
basename
(
$template
);
// use the provided page template, but allow overrides.
$page_template
=
locate_template
(
array
(
apply_filters
(
'civicrm_basepage_template'
,
'page.php'
)
/**
* In most cases, the logic will not progress beyond here. Shortcodes in
* posts and pages will have a template set, so we leave them alone unless
* specifically overridden by the filter.
*
* @param string $template_name The provided template name
* @return string The overridden template name
*/
apply_filters
(
'civicrm_basepage_template'
,
$template_name
)
)
);
if
(
''
!=
$page_template
)
{
// if not homepage and template is found
if
(
''
!=
$page_template
&&
!
is_front_page
()
)
{
return
$page_template
;
}
// fallback
// find homepage the template
$home_template
=
locate_template
(
array
(
/**
* Override the template, but allow plugins to amend.
*
* This filter handles the scenario where no basepage has been set, in
* which case CiviCRM will try to load its content in the site's homepage.
* Many themes, however, do not have a call to "the_content()" on the
* homepage - it is often used as a gateway page to display widgets,
* archives and so forth.
*
* Be aware that if the homepage is set to show latest posts, then this
* template override will not have the desired effect. A basepage *must*
* be set if this is the case.
*
* @param string The template name (set to the default page template)
* @return string The overridden template name
*/
apply_filters
(
'civicrm_basepage_home_template'
,
'page.php'
)
)
);
// use it if found
if
(
''
!=
$home_template
)
{
return
$home_template
;
}
// fall back to provided template
return
$template
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment