Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

wordpress - Is there a way to force a plug-generated page to use singular.php?

On my wordpress site, I have a learning management system plugin and I'm using a theme builder called Thrive Theme Builder.

The LMS creates a dashboard page for users (dashboard.php). The issue is this page ignores all my theming, does not show my theme header or footer and is not the same layout.

After some investigation I found that the theme builder (which in fact is a full theme) uses the singular.php file to show pages. Apparently the page generated by the LMS does not.

This is the code in the theme's singular.php file

<?php
/**
 * The template for displaying all single posts
 *
 * @link    https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package thrive-theme
 */

thrive_template()->render();

This is the first part of the code from the dashboard.php page created by the plugin

<?php
get_header();


global $wp_query;

$dashboard_page_slug = '';
$dashboard_page_name = '';
if (isset($wp_query->query_vars['tutor_dashboard_page']) && $wp_query->query_vars['tutor_dashboard_page']) {
    $dashboard_page_slug = $wp_query->query_vars['tutor_dashboard_page'];
    $dashboard_page_name = $wp_query->query_vars['tutor_dashboard_page'];

Any ideas how I can get this to work? How do I make the dashboard.php page use my theme settings?

I've tried adding the thrive_template()->render(); to the dashboard.php page but that causes the dashboard to show up inside my theme and inside itself, very strange.

question from:https://stackoverflow.com/questions/65878320/is-there-a-way-to-force-a-plug-generated-page-to-use-singular-php

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...