Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Showcase


Channel Catalog


Channel Description:

WordPress › Support

older | 1 | .... | 374 | 375 | (Page 376) | 377 | 378 | .... | 413 | newer

    0 0

    I would like to have all the posts displayed for a specific tag and also have the ability to have comments at the page level (not post level!) so users can comment on the whole list of posts.

    What is the best approach to doing this?


    0 0

    I know basically nothing about php and would love someone's help regarding the following edit I'm trying to make on my Wordpress website.

    Here is the current and working section of the code I'm trying to edit:

    elseif ( is_singular( 'post' ) ) {
    		$title = get_the_title();
    		$subtitle = get_the_date() . ' - ' . get_the_category_list( ', ' );

    Here is what I'd like to add to the code above:

    Published:
    Updated: <?php echo date('j F Y'); ?>

    Here is what I've tried without success:

    elseif ( is_singular( 'post' ) ) {
    		$title = get_the_title();
    		$subtitle = 'Published:' get_the_date() . ' - ' . get_the_category_list( ', ' )
    		'Updated: <?php echo date('j F Y'); ?>';

    Additionally, it would actually be amazing if someone could help me make the edits noted above to apply strictly to a certain post category (as the above will be applied to all 'post'(s).

    For more information or parameters, below is the full section of code as it appears in my functions.php file:

    function rainy_page_header() {
    	$title = '';
    	$subtitle = '';
    
    	if ( is_front_page() && is_home() ) {
    		$title = get_theme_mod( 'rainy_default_blog_title', 'Blog' );
    		$subtitle = get_theme_mod( 'rainy_default_blog_subtitle', 'Blog subtitle' );
    	} elseif ( is_singular( 'post' ) ) {
    		$title = get_the_title();
    		$subtitle = get_the_date() . ' - ' . get_the_category_list( ', ' );
    	} elseif ( is_home() ) {
    		$blog = get_post( get_option( 'page_for_posts' ) );
    		$title = $blog->post_title;
    		$subtitle = get_post_meta( $blog->ID, 'rainy_subtitle', true );
    	} elseif ( is_tax() ) {
    		$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    		$title = $term->name;
    		$subtitle = category_description();
    	} elseif ( is_category() ) {
    		$title = single_cat_title( '', false );
    		$subtitle = category_description();
    	} elseif ( is_tag() ) {
    		$title = single_tag_title( '', false );
    		$subtitle = tag_description();
    	} elseif ( is_day() ) {
    		$title = get_the_date();
    		$subtitle = __( 'Daily archives', 'spartan01' );
    	} elseif ( is_month() ) {
    		$title = get_the_date( 'F Y' );
    		$subtitle = __( 'Monthly archives', 'spartan01' );
    	} elseif ( is_year() ) {
    		$title = get_the_date( 'Y' );
    		$subtitle = __( 'Yearly archives', 'spartan01' );
    	} elseif ( is_author() ) {
    		$title = get_the_author();
    		$subtitle = __( 'Author archives', 'spartan01' );
    	} elseif ( is_search() ) {
    		$title = __( 'Search results for: ', 'spartan01' ) . get_search_query();
    	} elseif ( is_404() ) {
    		$title = __( 'Error 404', 'spartan01' );
    		$subtitle = __( 'Page not found', 'spartan01' );
    	} else {
    		$title = get_the_title();
    		$subtitle = get_post_meta( get_the_ID(), 'rainy_subtitle', true );
    	}
    
    	echo '<div class="page-header">';
    		echo '<h1 class="page-title">' . $title . '</h1>';
    
    		if ( $subtitle ) {
    			echo '<div class="page-subtitle">' . $subtitle . '</div>';
    		}
    	echo '</div>';
    }

    Any help/support is greatly appreciated.


    0 0

    I've noticed this happen in the past temporarily but now it's a permanent issue. It was happening on 4.4 and still happening on 4.5.
    I'm trying to get the packaged version of jquery with $GLOBALS['wp_scripts']->registered['jquery'] but it's empty. however, the list exists if i login to wordpress first and have the adminbar loaded.

    add_action('wp_enqueue_scripts', function(){
      $system_jquery = $GLOBALS['wp_scripts']->registered['jquery'];
      wp_deregister_script('jquery');
    });

    i've tried adding a priority value for the add_action.


    0 0

    I'm new to plugin development and have created a simple plugin that creates:

    1. a custom post type
    2. a couple of taxonomies for the post type
    3. custom boxes to collect additional post meta data

    My question: is there a way to add that collected post meta data to a theme's existing templates, say an archive? It's super easy to display in a custom theme, but I want it to work on any theme.


    0 0

    Hey.

    I use segment to track users behavior.
    Now i want to track if user register a new user.

    I try:

    function new_user_register( $user_id ) {
        global $new_user_register;
        // store ID if i need it later
        $new_user_register = $user_id;
    
        add_action( 'wp_footer', 'new_user_script' );
    }
    
    add_action( 'user_register', 'new_user_register' );
    
    function new_user_script() {
        global $new_user_register;
    
        echo "<script type='text/javascript'>
    			analytics.track('registraion ', {
    			plan: 'new',
    			});
    		</script>";
    }

    But don't work.

    Best Regards


    0 0

    Currently when people google us and visit the link to our website it redirects them to porn. When someone manually enters our website in the address bar it does not seem to be an issue. Could someone please help me correct this? I am getting multiple calls from parents.

    onenten.org

    I have tried reading other posts with instructions on how to fix the issue however I am unable to comprehend the instructions. I am new to website management so I need things extremely simplified, step-by-step to understand how to correct the situation.

    Thank you,
    Crystal


    0 0

    Hi, I have a form provided with ID and Class...and I want them to call my product title using my function.php if possible.By the way, I want to make a dropdown, that's why..

    How can I do that??here is my code..

    <label for="promolist">You selected this promo</label>
    <div class="form-control" id="promolist">

    </div>


    0 0

    Hi,

    I have 3 custom post type A, B, C, each have 10 posts
    How to display last A, last B, last C, before last A, before last B, before last C … first A, first B, first C.
    I could make three loops with wp_query and do some code but may be there is a trick or a better way ?

    I found this old post : https://wordpress.org/support/topic/display-one-post-per-category?replies=3


    0 0

    Hi guys.

    Hope someone can help me out with this one. My skills are very limited with PHP.

    Need a filter for my function.php that will replace a button with some text based on when their account was created. After 24 hours the button should appear reappear. Anyone who can help me get started on this?

    Any help is appreciated.

    Regard Andreas


    0 0

    I'm trying to change all products that are private to super admin as author in multisite.
    Here is what I have

    function update_author($data) {
      if ('product' == ['post_type'] && 'private' == ['post_status']) {
        $data['post_author'] = '1';
      }
      return $data;
    }
    add_filter( 'wp_update_post' , 'update_author', '99', 2 );

    I'm not sure what I'm doing wrong here..


    0 0

    I made a custom taxonomy named Location

    I was able to add a filter to de post with the following code(the show_count is not correct...it displays 200 listed but there are only 183 items with that taxonomy):

    add_action('restrict_manage_posts', 'tsm_filter_post_type_by_taxonomy');
    function tsm_filter_post_type_by_taxonomy() {
    	global $typenow;
    	$post_type = 'post'; // change to your post type
    	$taxonomy  = 'location'; // change to your taxonomy
    	if ($typenow == $post_type) {
    		$selected      = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : '';
    		$info_taxonomy = get_taxonomy($taxonomy);
    		wp_dropdown_categories(array(
    			'show_option_all' => __("All Locations"),
    			'taxonomy'        => $taxonomy,
    			'name'            => $taxonomy,
    			'orderby'         => 'name',
    			'selected'        => $selected,
    			'show_count'      => true,
    			'hide_empty'      => true,
    		));
    	};
    }
    
    add_filter('parse_query', 'tsm_convert_id_to_term_in_query');
    function tsm_convert_id_to_term_in_query($query) {
    	global $pagenow;
    	$post_type = 'post'; // change to your post type
    	$taxonomy  = 'location'; // change to your taxonomy
    	$q_vars    = &$query->query_vars;
    	if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0 ) {
    		$term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
    		$q_vars[$taxonomy] = $term->slug;
    	}
    }

    But i also like to add the column with to the list.I found a lot of useful codes. But non did really help me. Most are for custom post types.

    The following works for me, but when i press on the taxonomy listed to a post. I will get redirected to the frontend; example.com/location/benelux. I would like it to do the same as the categories and just update what is listed.

    /* Display custom column */
    function custom_columns_location( $column, $post_id ) {
        if ($column == 'location'){
               echo get_the_term_list($post_id,'location','',', ','');
        }
    }
    add_action( 'manage_posts_custom_column' , 'custom_columns_location', 10, 2 );
    
    /* Add custom column to post list */
    function add_custom_columns( $columns ) {
        return array_merge( $columns,
            array( 'location' => __( 'Location', 'your_text_domain' ) ) );
    }
    add_filter( 'manage_posts_columns' , 'add_custom_columns' );

    0 0

    I know I have done this before but I can't find the old snippets or the answer on the 'Net. I am using a filter to add links to the next and previous posts at the end of the_content. It's showing at the end but it's showing after a "related posts" plugin. I need it to display at the end of the text from the post and before the plugin output. Sure I could hack the plugin but I'd rather use functions.php in the custom theme. Here's the simple code I'm using:

    add_filter( 'the_content', 'next_prev_after_content' );
     function next_prev_after_content( $content ) {
        if ( is_single('post')) {
            $content .= previous_post_link();
    	$content .= next_post_link();
    	}
     return $content;
    }

    Admittedly I'm taking sinus medicine so my brain is foggy but this seemed simple in past times.


    0 0

    Good Day,

    I am really hoping someone can help me as I have spent a heap of time trying to fix this.

    I have created Store Locator Functionality using ordinary posts that utilise custom fields using the Advanced Custom Fields Plugin.

    I have compiled functions that count stores (posts) depending on the selection of a radio button group that is added to normal post edit pages via the Advanced Custom Fields Plugin. These functions are in my functions.php document and they have been created as shortcodes to be used in a specific page.

    This Radio Button Group will allow you to select one of two options - Member or Wholly Owned. It is set to select Wholly Owned by default. So upon creating the post, Wholly Owned is already selected and you'll only change it if you'd prefer it to be Member.

    I know what the end amount should be, the purpose of the code is to increment the relevant value every time you add or remove a new store.

    I'm pretty sure I had this code returning the correct value at one stage, but now it seems to be adding an extra value. It is meant to return 198 but it is returning 199.

    The Member count is spot on, it returns the expected 32.

    Here is what I can say for sure:
    • The code for each function is identical.
    • I have 'Returned' all of the 'Titles' of 'Wholly Owned' and it has returned 198 results.
    • When I filter the posts in my back end to display only posts under the 'Store Locator' category, it shows 230 posts, when you subtract 32, which is the 'Member' amount, you get 198.
    • I have set 'post_status' to 'publish' so it shouldn't be fetching deleted Posts, and I do not have any Store Locator posts in my trash folder.
    • Only Store Locator Posts can contain these Meta Values as the Advanced Custom Fields will only Appear when a Sub-Category of Store Locator is selected.

    Please let me know if you are able to shed some light on this, I am baffled. Please also let me know if you need any further information?

    Thanking you in advance :)

    Please see my code below:

    // Function to count Wholly Owned Stores
    	function count_wholly_owned_stores() {
    		$wholly_owned_stores = get_posts(array(
    			'post_type'	=> 'post',
    			'meta_key'	=> 'wholly_owned/member',
    			'meta_value'	=> 'Wholly Owned',
    			'posts_per_page' => -1,
    			'post_status' => 'publish',
    			'post_parent'      => 'store-locator'
    		));
    	$number_of_wholly_owned = count($wholly_owned_stores);
    	return $number_of_wholly_owned;
    	}
    	wp_reset_query();
    	add_shortcode('amt_wholly_owned', 'count_wholly_owned_stores');
    
    	// Function to count Member Owned Stores
    	function count_member_owned_stores() {
    		$member_owned_stores = get_posts(array(
    			'post_type'	=> 'post',
    			'meta_key'	=> 'wholly_owned/member',
    			'meta_value'	=> 'Member',
    			'posts_per_page' => -1,
    			'post_status' => 'publish',
    			'post_parent'      => 'store-locator'
    		));
    	$number_of_member_owned = count($member_owned_stores);
    	return $number_of_member_owned;
    	wp_reset_query();
    	}
    	add_shortcode('amt_member_owned', 'count_member_owned_stores');

    0 0

    Hello everyone!

    I am developing a plugin for Wordpress where I want to detect that a post is published and capture the published information, use the published information to fill out a template of a custom HTML file and write out the custom HTML file.

    So far, I have not had much success as I have tried hooking into transition_post_status action, but I have not been able to get the advanced custom fields plugin's data as that plugin saves data after transition_post_status action is fired.

    Then I tried using wp_insert_post, but that action fires when the post goes in auto draft the moment the editor enters a title so I don't get any content.

    Since this is plugin is not for public facing use, I am not including a URL to the site.

    Please help me by letting me know how to go about this task.

    Thanks!


    0 0

    I need to add the image of my post in search results and increase the amount of posts that people see , which is now only four .

    The search.php code:

    <?php
    /**
     * The search template file.
     *
     * @package Betheme
     * @author Muffin group
     * @link http://muffingroup.com
     */
    
    get_header();
    
    $translate['search-title'] = mfn_opts_get('translate') ? mfn_opts_get('translate-search-title','Ooops...') : __('Ooops...','betheme');
    $translate['search-subtitle'] = mfn_opts_get('translate') ? mfn_opts_get('translate-search-subtitle','No results found for:') : __('No results found for:','betheme');
    
    $translate['published'] 	= mfn_opts_get('translate') ? mfn_opts_get('translate-published','Published by') : __('Published by','betheme');
    $translate['at'] 			= mfn_opts_get('translate') ? mfn_opts_get('translate-at','at') : __('at','betheme');
    $translate['readmore'] 		= mfn_opts_get('translate') ? mfn_opts_get('translate-readmore','Read more') : __('Read more','betheme');
    ?>
    
    <div id="Content">
    	<div class="content_wrapper clearfix">
    
    		<!-- .sections_group -->
    		<div class="sections_group" style="width:100% !important;">
    
    			<div class="section">
    				<div class="section_wrapper clearfix">
    
    					<?php if( have_posts() ): ?>
    
    						<div class="column one column_blog">
    							<div class="blog_wrapper isotope_wrapper">
    
    								<div class="posts_group classic">
    									<?php
    										while ( have_posts() ):
    											the_post();
    											?>
    											<div id="post-<?php the_ID(); ?>" <?php post_class( array('post-item', 'clearfix', 'image_wrapper') ); ?>>
    
    												<div class="post-desc-wrapper">
    													<div class="post-desc">
    
    														<?php if( mfn_opts_get( 'blog-meta' ) ): ?>
    															<div class="post-meta clearfix">
    																<div class="author-date">
    																	<span class="author"><span><?php echo $translate['published']; ?> </span><i class="icon-user"></i> <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php echo get_the_author_meta( 'display_name' ); ?></a></span>
    																	<span class="date"><span><?php echo $translate['at']; ?> </span><i class="icon-clock"></i> <?php echo get_the_date(); ?></span>
    																</div>
    															</div>
    														<?php the_post_thumbnail( $size, $attr ); ?>
    
    <?php  endif; ?>
    
    														<div class="post-title">
    															<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    														</div>
    
    														<div class="post-excerpt">
    															<?php the_excerpt(); ?>
    														</div>
    
    														<div class="post-footer">
    															<div class="post-links">
    																<i class="icon-doc-text"></i> <a href="<?php the_permalink(); ?>" class="post-more"><?php echo $translate['readmore']; ?></a>
    															</div>
    														</div>
    
    													</div>
    												</div>
    											</div>
    											<?php
    										endwhile;
    									?>
    								</div>
    
    								<?php
    									// pagination
    									if(function_exists( 'mfn_pagination' )):
    										echo mfn_pagination();
    									else:
    										?>
    											<div class="nav-next"><?php next_posts_link(__('&larr; Older Entries', 'betheme')) ?></div>
    											<div class="nav-previous"><?php previous_posts_link(__('Newer Entries &rarr;', 'betheme')) ?></div>
    										<?php
    									endif;
    								?>
    
    							</div>
    						</div>
    
    					<?php else: ?>
    
    						<div class="column one search-not-found">
    
    							<div class="snf-pic">
    								<i class="themecolor <?php mfn_opts_show( 'error404-icon', 'icon-traffic-cone' ); ?>"></i>
    							</div>
    
    							<div class="snf-desc">
    								<h2><?php echo $translate['search-title']; ?></h2>
    								<h4><?php echo $translate['search-subtitle'] .' '. esc_html( $_GET['s'] ); ?></h4>
    							</div>
    
    						</div>
    
    					<?php endif; ?>
    
    				</div>
    			</div>
    
    		</div>
    
    	</div>
    </div>
    
    <?php get_footer(); ?>

    And I'm using css :

    .search .post {float: center; width: 185px; border: none; margin: 15px; }
    .search .post image_wrapper {width: 185px; height: 185px; border: none; }
    .navigation .search {clear: both; }

    The only thing I got so far is to have separation columns , but I need images and more posts.
    can you help me?


    0 0

    Hello,

    I've looked everywhere, and it seems to be an issue with WP. I am giving my posts a parent and a child (category and subcategory) to make things more organized, but for some reason, wordpress cannot do that to all posts.

    My permalinks structure is as follows: example.com/%category%/%postname%/

    Now according to WP it should show both the parent and the child in the URI (site.tld/parent/child/post), but it doesn't. After a lot of research, it turns out the only way to force it to do that properly is to give the parent a greater ID number than the child, which seems like a primitive tempo fix as it only makes things worse. What if I keep adding subcategories to that parent? That means I will have to keep on tinkering with my database on a regular basis. Is it possible to give the parent an ID of 9000 without causing conflicts with WP category creating system?

    Many suggested that I only select the sub-category from the post edit page, but this is not solving the issue. In fact, it is making it more messy. I want both categories to be added and both of them to be in the permalinks, in an organized way.

    Sorry for the long post, but I've been looking everywhere for a solution.

    Thanks in advance.


    0 0

    I have a custom post type (abc)
    some authors have 1 custom post in this CPT
    Assigned to this CPT is a CT called xyz

    taxonomy-xyz isn't displaying any of the cp from cpt 'abc'


    0 0

    Hi, I am echoing shortcodes(my forms) via button...How can I do that?


    0 0

    Hello, thank you for any knowledge you bestow upon me. And happy Earthday.

    I would like to have a post type with a meta box controlling the comments form on that specific authors post. The meta box located on the create post admin area and would allow an author to create repeatable input fields to display on their cpt comments section. The comments would be hidden from the post. The author would be able to view the users bio and comments in the admin area. Basically I need a users to reply privately to an authors post by using a form the author creates on their post.

    Any help would be greatly appreciated. Also I just started learning object oriented php so I am trying to keep everything organised like that. thanks a million


    0 0

    Hi All,

    i'm looking for two pieces of code that can help me with the following:

    I got posts and pages with a custom menu. These posts/pages got a custom template activated. The templates contains the menu for the specific posts and pages. This way i can order pages/posts in two different categories.

    Now i like to change the search function; the search output should be based on the active custom menu category.

    I named menu 1: Benelux and menu 2: International

    1: First peace of code needs to be for the searchform.php
    The code should look at the current active menu(category) and the search result should be based on the active menu.

    If the menu is for example "Benelux" then the search result should only display pages/posts from the custom taxonomy that i made <input type="hidden" name="location" value="benelux" />
    Or if the active menu is "International" then display pages/posts from the custom taxonomy <input type="hidden" name="location" value="international" />

    I found the following code to get the menu category...not sure if this is useful..

    (wp_nav_menu( array(
        'menu' => 'benelux'
    ) )

    2: Second peace of code is needed for the search.php (header).
    Because if the output should work correctly than we also need to change the menu for this search result page. Default the search.php uses the main menu.

    So the following code needs to see if the pages/post contain taxonomy benelux or international and change the menu accordingly.

    It would just be really awesome if this is possible.

    Greatings,
    Taro


older | 1 | .... | 374 | 375 | (Page 376) | 377 | 378 | .... | 413 | newer