Tag Info

New answers tagged

0

I Found my mistake. Basically, I had a bad prefix... I changed the function name of the get_post_meta to $gwrrest_stored_meta but then missed it in the echo of the text area content. I had "recycled" my code and accidentally left is as $prfx_stored_meta. So the line here: <textarea name="specials-textarea" id="specials-textarea"><?php if ( ...


0

You can get same result by outputting values from PHP array. Since it is multicolumn array, you will need to run foreach loop and get values of each child item. Mostly it's standard PHP stuff, nothing special. Although earlier you did not need to supply post ID in each WordPress function since you were using it inside a loop, but now you will have to do ...


2

Open comments.php file inside your theme's folder <?php if ( comments_open() ) : ?> <?php $fields = array( 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'responsive' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" ...


0

Yes, you'll want to create custom metaboxes for those. This is a pretty good intro into how to do that. But you might want to think through a few things: Are you sure you want that added to ALL posts? If not, perhaps create a custom post type and attach those fields to that post type instead. Maybe you really DO want it on Posts and not a Custom Post Type, ...


1

You typed "mobiles" when you said you wanted to check for post type "mobile". So simply remove the s ;). <? if( post_type_exists( 'mobiles' ) ) { echo 'The Products post type exists';} ?> Should be: <? if( post_type_exists( 'mobile' ) ) { echo 'The Mobile post type exists';} ?> If it's still not working, triple check if you ...


1

You may also want to remove the meta boxes from the Post Creation page // REMOVE POST META BOXES function remove_my_post_metaboxes() { remove_meta_box( 'categorydiv','post','normal' ); // Categories Metabox remove_meta_box( 'tagsdiv-post_tag','post','normal' ); // Tags Metabox } add_action('admin_menu','remove_my_post_metaboxes');


1

By using get_post_meta() fetch the custom field data $key_value = get_post_meta( get_the_ID(), 'key', true ); // check if the custom field has a value if( ! empty( $key_value ) ) { echo $key_value; } also see for more detail get_post_meta()


1

See get_post_meta() Example: get_post_meta($post->ID, 'EXAMPLEFIELD', true);


0

Andrew Bartel is on the right path, but the link doesn't quite do what you want. For static PHP files to access WordPress core functionality you need to add this to the top of the PHP file: define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require( dirname( __FILE__ ) . '/wp-blog-header.php' ); (This code is from ...


0

You can try using plugins that helps you add custom fields. types, custom content type manger,advance custom fields, etc can be used to easily add custom fields and more over you can also make the fields appear in loop so it will be easy for you to add more images if you like.


0

Here is a sophisticated way of creating the social links and then retrieving them back where you need using a simple function. You can use this function to create a shortcode too. (I copied the code from one of my project, so you might want to change some of the class prefixes if you like). /*-----------------------------------------------------------*/ ...


2

Of course you can specify only the items you want to remove. Have a look in the code below: /wordpress/wp-content/plugins/your_plugin/your_plugin.php : add_action('admin_init', 'nwcm_admin_init'); function nwcm_admin_init() { // Remove unnecessary menus $menus_to_remove = array( // menu items you want to remove 'menu_item_1', ...


2

From /wp-includes/script-loader.php: $scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 ); From wp-admin/upload.php: wp_enqueue_script( 'media-grid' ); wp_enqueue_script( 'media' ); wp_localize_script( 'media-grid', '_wpMediaGridSettings', array( 'adminUrl' => parse_url( self_admin_url(), ...


0

The link you want to modify is generated via Javascript in the file /wp-includes/js/media-grid.js (normally the minified version is loaded: /wp-includes/js/media-grid.min.js). At line 314 (in Wordpress 4.0.1) : 313: routes: { 314: 'upload.php?item=:slug': 'showItem', 315: 'upload.php?search=:query': 'search' 316: }, You can try ...


-2

Better thing is that if you have all pages in html format of you current site , following will help you to convert html to wordpress as per your given partition : http://www.wpexplorer.com/create-wordpress-theme-html-1/


0

Try this: <a href="<?php echo $tickets['link'][0]; ?>" class="tickets_btn">Tickets</a> Its better to use esc_url() to display URL. Like: <?php echo esc_url($tickets['link'][0]); ?>


0

You would be changing the wordpress back-end, these changes will be lost when updating. I suggest you press this button instead: http://i.imgur.com/5Ce3MzH.png (Only had a danish installation at hand, but it should look the same) This gives you a detailed view, and all links in this view, leads to the "More details" page. Hope this could help!


0

I'm afraid this is the problem: Wrong: <?php if ( $depth + 1) { ?> Correct: <?php if ( $depth > 1) { ?> That is what I think...


-2

Go to "Pages" and find the page with the ID. Open it in editor. On the right hand side, look for "page attributes". You can add php files here. All you have to do is, create a PHP page under your theme, and add this to your beginning of the file: <?php /* Template Name: A PAGE NAME HERE */ Reload, and your file shows up with the A PAGE NAME HERE ...


2

You can do this easy way or hard way. Hard way would be you creating custom functions to remove all menu classes and add FontAwesome icons accordingly. And easy way would be this. Go to Appearance > Menus And add FontAwesome icons in menu items. Like this. Note: You don't need to change page titles on each page. Just menu labels.


-1

Okay, so here is the complete query for displaying popular posts of current week. I am using meta_query to limit query results within current week only. It will get all posts from current week and then sort them by post views count added by custom field wpb_post_views_count that you used in your question. // Current week's popular posts $query_args = ...


0

How accurate does it have to be? You'll need to do some kind of incriment counter, and some kind of cleanup function. To be 100%, you will have to keep 7 data points for each post if you want it to be accurate. Keep an 8th (the computed sum), for efficiency. Then your cleanup function should drop the last data point and recalculate the sum once a day. You ...


2

include the conditional tag is_paged() within your if statement; example: if ( $i == 1 && !is_paged() ) :



Top 50 recent answers are included