有人知道我如何定制wp activate吗。php?
它将内容包装在<div id="content" class="widecolumn">
, 然而,在我的主题中,主包装是<div id="main">
大概我可以div#content.widecolumn
与相同div#main
. 但我很好奇,是否有人知道如何在不编辑它的情况下自定义此文件。
有人知道我如何定制wp activate吗。php?
它将内容包装在<div id="content" class="widecolumn">
, 然而,在我的主题中,主包装是<div id="main">
大概我可以div#content.widecolumn
与相同div#main
. 但我很好奇,是否有人知道如何在不编辑它的情况下自定义此文件。
你说得对,这很有意思。
我最终做的是创建两个新的页面模板Register 和Activate 使用这些模板创建两个新的WordPress页面,然后在我的functions.php
文件来修改行为1wpmu_signup_user_notification.
用户将在此新的注册页面上注册,并将向他们发送一封链接到新激活页面的电子邮件。
wp-signup.php
并从开头删除以下行:require( dirname(__FILE__) . \'/wp-load.php\' );
require( \'./wp-blog-header.php\' );
我也改变了<div id="content" class="widecolumn>
到<div id="main">
以适应模板。我还将表单操作值从action="<?php echo network_site_url(\'wp-activate.php\'); ?>"
到action=""
wp-activate.php
并从开头删除以下行:define( \'WP_INSTALLING\', true );
/** Sets up the WordPress Environment. */
require( dirname(__FILE__) . \'/wp-load.php\' );
require( \'./wp-blog-header.php\' );
我改变了<div id="content" class="widecolumn>
到<div id="main">
以适应模板。再次,我将所有表单操作更改为action=""
wp-includes/ms-functions.php
进入我的functions.php
文件将其重命名为独特的名称:af_wpmu_signup_user_notification
删除了以下内容:
if ( !apply_filters(\'wpmu_signup_user_notification\', $user, $user_email, $key, $meta) )
return false;
我换了线site_url( "wp-activate.php/?key=$key" )
到site_url( "activate/?key=$key" )
自从activate 是我的激活页的页段塞。然后,我使用以下代码将其作为过滤器应用:
add_filter(\'wpmu_signup_user_notification\', \'af_wpmu_signup_user_notification\', 10, 4);
这似乎工作正常-我可以随意修改这些页面,而不会影响核心。虽然这感觉有点太粗糙了。不要忘记在af\\u wpmu\\u signup\\u user\\u通知中将return更改为false。否则将向用户发送两封邮件。一个是旧链接,一个是新链接。
这里的主要问题是:wp-activate.php
包括您的header.php
但不是functions.php
. 如果在标头中使用在functions.php
.
我在主题中使用了两个新文件:
header-activate.php
和footer-activate.php
wp-activate.php
称为常量WP_INSTALLING
设置为TRUE
(无明显原因)。我在我的header.php
: 我包括functions.php
并调用我的设置功能。header.php
// on wp-activate.php this is FALSE
if ( ! function_exists( \'t5_setup\' ) )
{
require_once dirname( __FILE__ ) . \'/functions.php\';
t5_setup();
}
if ( defined( \'WP_INSTALLING\' ) and WP_INSTALLING )
{
locate_template( \'header-activate.php\', TRUE, TRUE );
return;
}
因此,我阻止执行常规头文件,并使用自定义头文件。header-activate.php
<?php # -*- coding: utf-8 -*-
declare( encoding = \'UTF-8\' );
?>
<!Doctype html>
<html <?php language_attributes(); ?> <?php body_class( \' \' ); ?>>
<head>
<title><?php
$current_title = wp_title( \'|\', FALSE, \'right\' );
print empty ( $current_title ) ? get_bloginfo( \'name\' ) : $current_title . get_bloginfo( \'name\' );
?></title>
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=Edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<?php
wp_head();
?>
<style>
#content
{
background: #333;
background: rgba(0, 0, 0, .7);
border: 1px solid #000;
border-radius: 10px;
box-shadow: 0px 0px 10px #000;
color: #eee;
font: 1em/1.45 sans-serif;
margin: 140px auto;
max-width: 400px;
padding: 40px;
}
#key
{
background: #ccc;
background: rgba(255, 255, 255, .5);
border: 0;
color: #eee;
width: 100%;
}
#key:focus
{
background: #fff;
color: #000;
}
.submit
{
text-align: right;
}
#submit
{
background: #222;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#444444\', endColorstr=\'#222222\')";
background-image: -o-linear-gradient(#444444,#222222);
background: -webkit-linear-gradient(#444444,#222222);
background: -moz-linear-gradient(#444444,#222222);
border: 2px solid #333;
border-color: #4d4d4d #333 #202020;
border-radius: 7px;
color: #eee;
width: auto;
}
</style>
</head>
<body>
如您所见,我没有使用外部样式表。不需要。但自定义背景图像仍处于活动状态。我在我的生活中也这样做footer.php
:
footer.php
if ( defined( \'WP_INSTALLING\' ) and WP_INSTALLING )
{
locate_template( \'footer-activate.php\', TRUE, TRUE );
return;
}
footer-activate.php
<?php # -*- coding: utf-8 -*-
declare( encoding = \'UTF-8\' );
wp_footer();
整个过程都是黑客的方式。我相信有更好的方法来处理这个问题。
我通过添加以下内容使激活页面与网站的其余部分相同:
require_once($_SERVER[\'DOCUMENT_ROOT\'].\'/wp-load.php\');
我只是想修改一些文本,以便能够使用放入mu插件/my函数中的代码过滤gettext。php。把它放在一个普通的插件中是行不通的,但你可以把它放在函数中。基本主题的php。
function rgbook_activate_page_action() {
add_filter(\'ngettext\', \'rgbook_activate_page_change_text\' );
add_filter(\'gettext\', \'rgbook_activate_page_change_text\' );
}
add_action( \'activate_header\', \'rgbook_activate_page_action\' );
function rgbook_activate_page_change_text( $text ) {
$search = \'<a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.\';
$replace = \'<a href="%1$s">Click here to log in now</a>.\';
return str_ireplace($search, $replace, $text);
}
我已经制作了我的第一个主题,现在我想创建不同的“简介”。这些概要文件只是用户可以尝试的独立CSS文件。关键是,如何使这些文件允许用户通过管理面板选择颜色方案?是的,我不想允许用户访问文件系统,所以他们必须使用管理面板更改CSS文件。怎么做?是否有允许更改CSS文件的插件?