wordpress-theming

What is the difference between get_the_* and the_* template tags in wordpress?

陌路散爱 提交于 2019-11-27 07:11:22
问题 I am confuse about get_the_* and the_* template tags. I have used those many times to my theme but i am not clear enough when to use get_the_* and when to use the_* . Would you please explain both concept clearly. 回答1: Typically, there are two key differences between get_the_* and the_* functions. get_the_* methods don't echo anything themselves. Instead, they return the value that you're interested in, normally as a string. For example, get_the_time() echoes nothing, and returns a string

WordPress path url in js script file

大城市里の小女人 提交于 2019-11-27 07:04:21
I added custom script: wp_enqueue_script('functions', get_bloginfo('template_url') . '/js/functions.js', 'search', null, false); It works great, except in the functions.js I have: Reset.style.background = "url('../images/searchfield_clear.png') no-repeat top left"; This used to work before, until I changed to pretty permalinks and .htaccess The folder hierarchy is like: themename/js themename/images (the images and js folder are in themename folder) I tried ../images - ./image - /images Normally it should go back 1 level wherever the js file is located.... I don't want to use full path. Is

wordpress - make custom field values clickable to retrive them later

时光怂恿深爱的人放手 提交于 2019-11-27 05:41:13
I want to add a custom column to my the all posts page of admin panel in wordpress. The scenario is - every post has a featured image. When I look at the all posts page in admin panel, then I have a custom column namely '*' and it has the value * in every row. I want to click the column value for a particular row to make it selected and have a different look (i.e. bold font). Then in the homepage I'll try to retrieve the featured image of those posts for which the custom column value has been selected by clicking on it. I followed this tutorial and added the following code in the theme's

Redirect after Login on WordPress

核能气质少年 提交于 2019-11-27 04:12:23
问题 I'm creating a customized WordPress theme based on an existing site. I want to use an alternate dashboard which I have created. How can I have the user directed to ' news.php ' after login instead of ' /wp-admin/ ' ? -- EDIT: Have a working Plug-in for this but the bounty is still availible for anyone who can find a manual way to do this through functions.php, as it would be more secure then using a 3rd party plug-in. 回答1: This should solve your problem. Adapted from an answer found here.

How to integrate WordPress template with CodeIgniter

主宰稳场 提交于 2019-11-26 23:52:41
How can CodeIgniter and WordPress be integrated such that the look and feel/template of the WordPress blog is carried over to the CodeIgniter-created pages? Click Upvote First step is to move CodeIgniter and the WordPress files in their own directory. After that, put the following line at the top of your CodeIgniter's index.php file. Change the path to wp-blog-header.php as needed to point to your WordPress's root directory. <?php require('../wp-blog-header.php'); Then, you can use the following functions inside your views: <?php get_header(); get_sidebar(); get_footer(); ?> Other helper

Trim headline to nearest word

空扰寡人 提交于 2019-11-26 21:51:24
问题 Say for example I have the following code: <h3>My very long title</h3> <h3>Another long title</h3> If I wanted to shorten these titles using PHP or jQuery, how can I trim them to the nearest word and append an ellipsis? Is it possible to specify a character count? <h3>My very long...</h3> <h3>Another long...</h3> Edit - How can I do this for each one of the headlines? I don't really have an idea as to how to pass each headline into a string... Thanks 回答1: Creating an ellipsis in PHP <?php

pagination on custom post wp_query

杀马特。学长 韩版系。学妹 提交于 2019-11-26 16:46:19
问题 <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $loop = new WP_Query( array( 'post_type' => 'html5-blank', 'posts_per_page' => 5, 'paged'=>$paged ) ); ?> <?php if ($loop->have_posts()): while ($loop->have_posts()) : $loop->the_post(); ?> //Loop Code Here.. <?php wp_reset_query(); ?> <nav> <?php previous_posts_link( 'Newer posts »' ); ?> <?php next_posts_link('Older »') ?> </nav> <?php endwhile; ?> <?php else: ?> Url on next page as I input result is: www.mywebsite.com

Can jQuery .load append instead of replace?

帅比萌擦擦* 提交于 2019-11-26 16:26:52
问题 I have a WordPress install and I'm trying to use jQuery to create a Load More effect. I'm having some trouble using the basic .load feature for page fragments. I don't mind using .get as I saw some threads here regarding that as a better solution. Here's my page URL structure and the contents: First Page: http://example.com/page/1/ The HTML: <div id="articles"> <div class="story">blah blah blah</div> <div class="story">blah blah blah</div> <div class="story">blah blah blah</div> <div class=

Adding custom image fields and other fields at the same time

我是研究僧i 提交于 2019-11-26 14:25:32
问题 I basically want to have a custom CMS page that has pairs of images and labels for those images defined within it. I intend to use these pairs of items for populating content on a custom page of my new WordPress theme. I have managed to make a new settings page within the CMS and populate any number of text boxes within it all thanks to Handling Plugins Options in WordPress 2.8 with register_setting(). I just now need to add fields for each text box that let a user open up the media browser

WordPress path url in js script file

醉酒当歌 提交于 2019-11-26 13:00:40
问题 I added custom script: wp_enqueue_script(\'functions\', get_bloginfo(\'template_url\') . \'/js/functions.js\', \'search\', null, false); It works great, except in the functions.js I have: Reset.style.background = \"url(\'../images/searchfield_clear.png\') no-repeat top left\"; This used to work before, until I changed to pretty permalinks and .htaccess The folder hierarchy is like: themename/js themename/images (the images and js folder are in themename folder) I tried ../images - ./image -