Tag Info

New answers tagged

0

Finally, I had to add the required code inside another shorcode I had in place to create the content structure. That way I avoided creating an extra shorcode and was able to put the custom code in the exact position I wanted. Thanks to all those who helped.


1

The WordPress built-in editor supports two editing modes, "Visual" and "Text." The "Text" mode allows you to directly edit the actual HTML of the page (or post), including any <div> elements that might be there.


1

The code you need will vary slightly depending on whether the Conference field is storing a text string (like "Big Ten") vs. the ID of the Conference post. I'll include both: Text String Example // place this code inside the loop of your single-team template $conference_name = get_post_meta( get_the_id(), 'conference', true ); $conference = ...


0

The best way to create dynamic data outputs really depends on the what, why, and how. For example, if you're creating a theme that creates its own custom post type, say, to store information about the head honchos that run the business behind the site, then just create a "single-$CPTNAME.php" template that has the code that you want. Another method of ...


0

Assuming you are looking for a solution to conditionally display your custom fields on public facing pages (non-edit page), you can use WordPress Conditional Tags. if ( is_page_template('template-name.php') ) { // Execute Your Code }


1

Create page templates inside your theme and create page-{template-name}.php for each one of them and you need to code the appropriate query for each case. Then go to each page inside admin panel, open each page and just assign each page to their matching template. If you are not familiar with how to do any of the above, provide the code of your current ...


-1

I have an idea! First, put the one copy of the list you want to edit into a widget with a text element. Second, place the widget on your page using a shortcode and this free plugin: Widgets on Pages Now, the same list appears on your site wherever the shortcode is placed!


0

You should call remove_meta_box in the add_meta_boxes hook to get it working. It tested on 4.0. add_action( 'add_meta_boxes', 'customize_admin_backend_cpt',0 ); function customize_admin_backend_cpt () { remove_meta_box( 'slugdiv', 'your_cpt_goes_here', 'normal' ); }


0

It is possible and quite easy to achieve. Here is how STEP 1 Copy content-featured-post.php to your child theme and open it up STEP 2 Just after line 32, paste the following code <?php echo get_the_date( 'Y-m-d' ); ?> Save this change, and your done As you can see, get_the_date is used to return the post date The get_the_date template tag ...


0

After here and there for long i find the solution for above : Replaced above meta tag with below <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> <?php if($image[0] != "" ){ ?> <meta property="og:image" ...


0

What about using the u var to share your url and let facebook get the content using Opengraph tags? Something like this <a onClick="window.open('http://www.facebook.com/sharer.php?u=<?php echo $url; ?>', 'sharer', 'toolbar=0,status=0,width=548,height=325');" target="_parent" href="javascript: void(0)">Custom Share on Facebook page!</a>


0

jdm2112 and cybmeta are right! You are missing important functions 'wp_head()' and perhaps 'wp_footer()'. You'll need wp_footer cuz wordpress loads sometimes some scripts in it. In your front-page.php <?php // My Custom Front Page ?> <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta ...


0

// PLUGINS THAT ADD AS DASHBOARD SUBMENU // IF THIS IS THE URL BELOW - THE PAGE VARIABLE IS WHAT I NEED ( SO WHATEVER COMES AFTER PAGE= ) // http://example.com/wp-admin/index.php?page=iconize-plugin-update-notifier remove_submenu_page( 'index.php', 'iconize-plugin-update-notifier' ); // OR FOR EXAMPLE WOOCOMMERCE DASHBOARD SUBMENU ...


0

It sounds as though you are confusing multiple issues. If you created front-page.php, added your content and made the settings in WP for this to display as the front page, then that part of your question is answered. If the login form and slider are not working on that template, you have a separate challenge to overcome. The login form and slider are ...


0

Don't user custom fields to fix it, you should better try this: if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ){ $post_id = wp_insert_post( $my_post ); }


1

You need to add a control to it. function mytheme_customize_register( $wp_customize ) { $wp_customize->add_section( 'mytheme_options', array( 'title' => __( 'MyTheme Options', 'ppr' ), 'priority' => 35, 'description' => __('Allows you to customize some example settings for MyTheme.', 'ppr'), ) ); ...


0

This is what I did on a recent site: $blog_page_object = get_queried_object(); $blog_page_title = $blog_page_object -> post_title; $blog_page_description = apply_filters('the_content', $blog_page_object -> post_content ); ?> <h1><?php echo( $blog_page_title ) ?></h1> <?php echo( $blog_page_description ) ?>


1

I think what you want is to create what WorpPress calls "Custom Post Types". Please have a look at the Post Type page in the Codex that explains what Post Types are and how to create custom ones. Basically, here is the code to create the Object custom post type : add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( ...


1

May be you can try this: add_filter('manage_edit-movie_columns', 'custom_add_new_columns'); function custom_add_new_columns( $columns ){ $columns['author_email'] = 'Email'; return $columns; } add_action('manage_movie_posts_custom_column', 'custom_manage_new_columns', 10, 2); function custom_manage_new_columns( $column_name, $id ){ if ...


1

Just use CSS to style your #nav li block. This is quick, but would make your links into buttons. #nav li { list-style: none; background: #F00; width: 120px; margin-right: 60px; padding: 10px; text-align: center; } you can add a hover class too like #nav li:hover


0

Why don't you add a custom body class to the page template which you can hard code into the template or add conditionally from your functions.php file like this: //* Add custom body class to the head add_filter( 'body_class', 'wpsites_body_class' ); function wpsites_body_class( $classes ) { if ( is_page_template('template-x.php') ) $classes[] = ...


0

Have a look at in_category() in the codex. You would either insert this into your theme within the post loop or create a function in functions.php that'll insert the image and text you want when a post from that category is displayed on screen. Here's a test bit of code I put together that works well in the Twenty Fourteen theme. I put it inside the loop ...


1

One common way to do similar task is creating a page template. For example: <?php /* Template Name: Reviews and Quotes */ get_header(); ?> <div id="content"> <div id="reviews"> <?php $reviews = get_the_reviews(); foreach( $reviews as $review ) { <?php <div ...


0

You could use a plugin like JSON API to create an endpoint on your WordPress installation and access it from your PHP site with Javascript. You'll still need to style it however.


0

Search Terms Dotifier: Here's one idea using the request filter to append "dotted" words of two or three characters that don't contain any dots, to the current search terms. So if your search string is for example: The LA Dreams it will become: The LA Dreams L.A. Here's a demo plugin to modify the default search: <?php /** * Plugin Name: ...


1

Yes you can. Straight from the codex The $wpdb object is not limited to the default tables created by WordPress; it can be used to read data from any table in the WordPress database (such as custom plugin tables). For example to SELECT some information from a custom table called "mytable", you can do the following. $myrows = $wpdb->get_results( ...


1

The problem is that your code, especially the global $post; and then $post->ID part is getting the $post_id of the page you are on from the $post global variable, not of the product(s) in your cart, which would be what you are looking for. Aside from that, the $args parameter of wp_get_post_terms has no argument taxonomy, besides you already ...


1

This is expected output from what you have in your code. Never change the main query for a custom query on any archive page or on the home page. Custom queries are always troublesome as the main query is quite specific on these pages. I would advice you to rather use pre_get_posts to alter the main query on that specific archive page or home page you want ...


1

There is the post type attachment, which is normally used to store information about files uploaded to WordPress' Media Library. Additional data can be saved into custom fields/postmeta. You definitely should look into that, if you decide to go with native WP tables. Another possibility would be to make those custom tables searchable, on the codex page ...


0

Extra bonus Easter Egg for those in need... After the foreach loop by adding... $output .= get_post_field('post_content', $related_post->ID); You will also get the current post content.


0

Ok guys found the solution myself (5 days later, oof) added below to help someone else in the future... foreach((get_the_category( $related_post->ID )) as $category) { $output .= "<a class=\"$category->slug\" href=\"".get_permalink( $related_post->ID )."\" title=\"" . $category->cat_name . "\">" . ...


0

A hacky way to do it is to do a string replace on the tmpl-attachment-details template: // See wp_print_media_templates() in "wp-includes/media-template.php" function wpse157297_print_media_templates() { $my_link = '<a class="my_link-attachment" href="my_link.php?url={{ data.url }}" target="_blank">' . __( 'My Link' ) . '</a>'; $nonimage ...


0

// This worked great for me so much thanks! I just adapted for what I needed. Right in template file, Sweet! global $wpdb; // QUERY HERE TO COUNT TOTAL RECORDS FOR PAGINATION $total = $wpdb->get_var("SELECT COUNT(*) $post_per_page = 10; $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1; $offset = ( $page * $post_per_page ) - ...


1

You can do this through the WordPress APIs without writing any MySQL. Use custom post types for your different content types and WordPress already handles subscriber registration, plugins like BuddyPress extend that. If you want more specific help please include some code.


1

You can use any of the parameters from wp_list_categories and the widget_categories_args filter You can style the output with these CSS selectors: li.categories { ... } li.cat-item { ... } li.cat-item-7 { ... } li.current-cat { ... } li.current-cat-parent { ... } ul.children { ... }


0

if your theme have not search-form.php file then you will create the file and add the custom css there. Because search widget is calling the get_search_form() function. First it will search the search-from.php file from activated theme folder. If there have no file then it will call wp's default search form. See the Codex



Top 50 recent answers are included