标签: wordpress

所见即所得html DIV之外抛出的WordPress简码

我正在尝试通过Wordpress页面所见即所得(WYSIWYG)编辑器在特定<div>元素中在页面中放入一个简码。短代码确实会出现并起作用。但是<div>,当页面呈现时,它不会停留在my内,而不会呈现在<div>页面的顶部附近,而是引导页面内容。

关于如何防止这种情况有什么想法?

我不想将其放在页面模板内。我试图将其放置在Pages WYSIWYG编辑器内布置的简单自定义html中。

例如,我在页面中放置简码,如下所示:

<div class="row">
<p>some custom page html content</p>
<div>
<div class="row">
[some_shortcode]
</div>
<div class="row">
<p>some custom page html content</p>
<div>
<div class="row">
<p>some custom page html content</p>
<div>
Run Code Online (Sandbox Code Playgroud)

而是这样渲染:

<!-- THE SHORTCODES HTML APPEARS HERE and Works but not where I wanted it. -->
<!-- then the rest of the pages html content -->
<div class="row">
<p>some custom page html content</p>
<div>
<div class="row"><!-- no more shortcode-->
</div>
<div …
Run Code Online (Sandbox Code Playgroud)

html wordpress static-html shortcode

0
推荐指数
1
解决办法
718
查看次数

将Wordpress(MySQL)数据库迁移到BigQuery

我不是那么技术,所以请原谅我错过使用条款.

我想为一个利基社区开设一个reddit样式网站.我正在考虑使用我发现的wordpress主题来构建MVP.我知道它不可扩展,如果网站起飞不够快,但它便宜且易于我设置.

我希望能够为前2000个用户使用Wordpress,然后再迁移到更具可扩展性的东西.我知道bigquery快速且可扩展,因此它是一个不错的选择.

迁移数据库有多容易?首先使用Wordpress真的很蠢吗?

任何其他建议将不胜感激.

mysql wordpress google-bigquery

0
推荐指数
1
解决办法
586
查看次数

带有wp_localize_script的Wordpress前端Ajax错误:未定义ajaxurl

我正在尝试通过wp主题上的ajax在地图上创建标记。经过一番挣扎之后,我发现我无法使用任何php文件通过ajax获取数据,我必须使用admin-ajax.php文件。

根据许多示例,这是我的代码

在functions.php中

add_action( 'wp_enqueue_scripts', 'add_frontend_ajax_javascript_file' );
function add_frontend_ajax_javascript_file()
{
   wp_localize_script( 'frontend_ajax', 'frontendajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
    wp_enqueue_script( 'ajax_custom_script',  get_stylesheet_directory_uri() . '/includes/ajax-javascript.js', array('jquery') );

}

add_action( 'wp_ajax_get_post_information', 'get_post_information' );
add_action( 'wp_ajax_nopriv_get_post_information', 'get_post_information' );


function get_post_information() 
{ 

$get_this= $_GET['this'];
$get_that= $_GET['that'];

...my select...

echo json formatted data
}
Run Code Online (Sandbox Code Playgroud)

js文件已加载并正常工作,它在ajax调用之前做了其他工作,在此行中由于出现错误而停止:

$.post({ 
        url:frontendajax.ajaxurl,
        {
            action: 'get_post_information',
            data: data
        },
        success: function(response) {
Run Code Online (Sandbox Code Playgroud)

但是我总是有同样的错误:

参考错误:未定义frontendajax.ajaxurl

我的错误在哪里?

PS:我使用get_stylesheet_directory_uri()是因为我处于子主题中。

php ajax wordpress jquery frontend

0
推荐指数
1
解决办法
7722
查看次数

after_widget的致命错误

我试图创建一个简单的窗口小部件以显示特定类别的帖子列表,但出现错误日志,"Notice: Undefined index: after_widget in"
我还注意到一个奇怪的事情,我的窗口小部件<aside>类使所有其他窗口小部件成为其子级,她没有关闭完成小部件代码后,

这是我的代码:

if ( !defined('ABSPATH') )
	die('-1');
	
	
add_action( 'widgets_init', function(){
     register_widget( 'news_roller' );
});	

function illu_news_widget(){

        wp_enqueue_style( 'your-stylesheet-name', plugins_url('/css/style.css', __FILE__), false, '1.0.0', 'all');
    }
    add_action('wp_enqueue_scripts', "illu_news_widget");

/**
 * Adds news_roller widget.
 */
class news_roller extends WP_Widget {

	/**
	 * Register widget with WordPress.
	 */
	function __construct() {
		parent::__construct(
			'news_roller', // Base ID
			__('News roller', 'isas_news'), // Name
			array( 'description' => __( 'News roller', 'isas_news' ), ) // Args
		);
	}

	/**
	 * …
Run Code Online (Sandbox Code Playgroud)

php wordpress widget wordpress-plugin

0
推荐指数
1
解决办法
646
查看次数

MAMP没有连接到localhost

刚刚在Yosemite上将MAMP更新为3.2.1版.Apache和MySQL服务器都是绿色的,但当我转到我的本地主机时,我不断得到:此网页在浏览器(Chrome)中无法使用ERR_NAME_NOT_RESOLVED.我尝试了隐身浏览和Firefox相同的结果,尝试了MAMP默认端口设置和端口80和3306,尝试重新安装MAMP并回滚到之前安装的MAMP; 一切都没有成功.

任何人都可以建议如何解决这个问题...它开始让我发疯!

mysql wordpress mamp localhost osx-yosemite

0
推荐指数
1
解决办法
2万
查看次数

如何在Wordpress中检查简码为空

我正在使用WooCommerce插件。我创建了一个销售页面,并使用[sale_products]WooCommerce的简码。它完美地显示了所有销售产品,现在我希望如果没有销售产品,则消息将显示为“没有销售产品”。

像这样:

if(!empty([sale_products])) {
    [sale_products]
} else {
    // message
}
Run Code Online (Sandbox Code Playgroud)

有什么办法可以解决这个问题?

php wordpress shortcode woocommerce

0
推荐指数
1
解决办法
2596
查看次数

这个数据是什么类型的结构?

我有一个带有此值的字段的mysql表:

a:18:{
i:0;
a:7:{
        i:0;
        i:10;
        i:1;
        s:5:"Email";
        i:2;
        s:10:"user_email";
        i:3;
        s:4:"text";
        i:4;
        s:1:"y";
        i:5;
        s:1:"y";
        i:6;
        s:1:"y";
    }
i:1;
a:7:{
        i:0;
        i:1;
        i:1;
        s:10:"First Name";
        i:2;
        s:10:"first_name";
        i:3;
        s:4:"text";
        i:4;
        s:1:"y";
        i:5;
        s:1:"y";
        i:6;
        s:1:"y";
    }
i:2;
a:7:{
        i:0;
        i:2;
        i:1;
        s:9:"Last Name";
        i:2;
        s:9:"last_name";
        i:3;
        s:4:"text";
        i:4;
        s:1:"y";
        i:5;
        s:1:"y";
        i:6;
        s:1:"y";
    }
i:3;
a:7:{
        i:0;
        i:4;
        i:1;
        s:9:"Address 2";
        i:2;
        s:5:"addr2";
        i:3;
        s:4:"text";
        i:4;
        s:1:"n";
        i:5;
        s:1:"n";
        i:6;
        s:1:"n";
    }
i:4;
a:7:{
        i:0;
        i:5;
        i:1;
        s:4:"City";
        i:2; …
Run Code Online (Sandbox Code Playgroud)

html mysql forms wordpress

0
推荐指数
1
解决办法
1414
查看次数

CSS last-child在菜单中没有工作

我有一个正在开发的网站,我正在尝试使用:last-child命令删除导航菜单上的右边框:http://new.solacetree.org/

.main-navigation .main-nav ul li a {
    border-right: 1px solid #fff;
}

.main-navigation .main-nav ul li a:last-child {
    border-right: 0 none;
}
Run Code Online (Sandbox Code Playgroud)

我也尝试向第一个孩子添加一个左边框但是它也不起作用:

.main-navigation .main-nav ul li a:first-child {
    border-left: 1px solid #fff;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<div class="main-nav"><ul class="menu sf-menu sf-js-enabled" id="menu-main-navigation"><li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1836" id="menu-item-1836"><a href="http://new.solacetree.org/?page_id=70" class="sf-with-ul">About Us</a><a aria-expanded="false" class="dropdown-toggle" href="#"><i class="fa fa-caret-down"></i></a>
<ul class="sub-menu" style="display: none;">
    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1852" id="menu-item-1852"><a href="http://new.solacetree.org/?page_id=1793">Letter from Emilio</a></li>
    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1853" id="menu-item-1853"><a href="http://new.solacetree.org/?page_id=1800">Our History</a></li>
    <li …
Run Code Online (Sandbox Code Playgroud)

html css wordpress css-selectors css3

0
推荐指数
1
解决办法
944
查看次数

在Wordpress站点上执行自定义css后,JS无法正常工作

我目前正在通过wordpress开发一个在线商店.一切都很好,现在我想给我的页面一个自定义边框(倒圆角),并找到它的CSS代码,如下所示:

CSS:

body {
  background-color: #fff;
}

.wrapper {
  overflow:hidden;
  width:200px;
  height:200px;


}

div.inverted-corner {
  box-sizing:border-box;
  position: relative;
  background-color: #3e2a4f;
  height: 200px;
  width: 200px;
  border: solid grey 7px;
}

.top, .bottom {
  position: absolute;
  width: 100%;
  height: 100%;
  top:0;
  left:0;

}

.top:before, .top:after, .bottom:before, .bottom:after{
  content:" ";
  position:absolute;
  width: 40px;
  height: 40px;
  background-color: #fff;
  border: solid grey 7px;
  border-radius: 20px; 
}

.top:before {
  top:-35px;
  left:-35px;


}

.top:after {
 top: -35px;
 right: -35px;
  box-shadow: inset 1px 1px 1px grey;
}

.bottom:before …
Run Code Online (Sandbox Code Playgroud)

javascript css wordpress jquery wordpress-theming

0
推荐指数
1
解决办法
92
查看次数

如何为多个角色设置add_submenu_page?

我已经创建了一些wordpress管理菜单,并且想为多个角色添加以下菜单:

add_submenu_page('Events', 'Colloqui', 'subscriber, editor', 'events', 'ww_events');
Run Code Online (Sandbox Code Playgroud)

这仅适用于订阅者角色。但是,我希望该菜单也具有管理员角色。

wordpress wordpress-plugin

0
推荐指数
1
解决办法
2127
查看次数