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


Channel Catalog


Channel Description:

WordPress › Support

older | 1 | .... | 387 | 388 | (Page 389) | 390 | 391 | .... | 413 | newer

    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

    I am sure that this is available online but for the life of me I cannot figure out how to word it to google to find it...

    I want to write a plugin that will produce a RSS feed (Don't ask - it's mainly for my own edification on how to write this). I have the code that produces that feed. I can follow basically everything for rolling it into a function with only one little thing escaping me :

    How do I hook into wordpress so that when a URL is called it responds? I mean I can respond if I dropped the function code into a file and plopped that file in wp-content/themese/theme/rss_feed.php but I want to have it respond when I call "http://www.blah.com/rss_feed".

    I figure it must be a hook I add but I cannot figure out which one it is...


    0 0

    Hi
    Same posts are displayed in all blog pages in my website.

    global $post;
    $page_id = $post->ID;
    $page_custom_fields = get_post_custom( $page_id);
    
    $page_sidebar_positioning = null;
    if (isset($page_custom_fields['page_sidebar_positioning'])) {
    	$page_sidebar_positioning = $page_custom_fields['page_sidebar_positioning'][0];
    	$page_sidebar_positioning = empty($page_sidebar_positioning) ? '' : $page_sidebar_positioning;
    }
    
    $section_class = 'full-width';
    if ($page_sidebar_positioning == 'both')
    	$section_class = 'one-half';
    else if ($page_sidebar_positioning == 'left' || $page_sidebar_positioning == 'right')
    	$section_class = 'three-fourth';
    
    $posts_per_page = get_option('posts_per_page');
    
    if ( get_query_var('paged') ) {
        $paged = get_query_var('paged');
    } else if ( get_query_var('page') ) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    
    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
    	'paged'			   => $page,
    	'posts_per_page'   => $posts_per_page,
    	'offset'           => 0,
    	'category'         => '',
    	'post_type'        => 'post',
    	'post_status'      => 'publish');
    
    ?>

    [Moderator Note: Please post code between backticks or use the code button. Your posted code may now have been damaged by the forum's parser.]

    Any error in the above code. Please help me out as I am stumbling.
    Thanks in advance
    JassV


    0 0

    So I am trying to redirect all template pages to a views/<page_name>.blade.php using https://github.com/tormjens/wp-blade

    This works as long as the corresponding .php file exists

    So for example, I have a blank 404.php and a corresponding views/404.blade.php that gets rendered if you go to a non-existent page.

    What I want is to not require a 404.php or page.php to exist at all, but currently in the template_include action, it will always send the template as "index.php" if the 404.php or page.php doesn't exist at all.

    So is there anyways to bypass this behavior?


    0 0

    The search results page looks horrible and I would like to modify to present a table since the search will mostly be used as a parts search. All inventory has been divided up into categories with 1 category being our Master Inventory list. Unfortunately, since the files are so large, I had to use the "Embed a document" plugin to create most of the pages of inventory.

    After must research, I have found that I need to modify the look within the search.php file. My problem is that I am unsure what code to use to have it display correctly as a 6 column table (Part Number, NSN, Alt. P/N, description, condition and quantity) showing only the part number information searched. The data would have to be pulled from the data created from the "Embed a document" plugin. I am simply at a loss of how to create the needed loop to display this correctly so that just the part number search shows up instead of the whole long list of inventory.

    As an example, try searching "50-8792-3"

    The website is http://www.calportaviation.com.

    Any help with the coding would be much appreciated!

    Thank you!


    0 0

    Hello,
    I have been attempting to add a couple of custom buttons to my TinyMCE instance but I can't seem to find where to add them in.
    I've already written the JS for the button but I don't know where I can actually add it in.
    If you need any excerpts just ask.
    Can anyone point me in the right direction?


    0 0

    Is there any way to attach post to taxonomy term before creating the post?
    I thought maybe there is a way with url parameter such as:
    http://mywebsite.com/wp-admin/post-new.php?post_type=custompost&tax=TAXNAME&term=TAXTERM

    Is there any way of doing that?


    0 0

    Hello

    I use woocommerce and the XML order Export plugin, wich I adapted to the Output i Need. The following lines of code

    'REMARK' => array(
    					'@attributes' => array( 'type' => 'arbitrary_data' ),
    					$order->get_item_total( $item_data, false ),
    				),

    produce this part in XML Export

    <REMARK type="arbitrary_data">527.41</REMARK>

    But what I Need is
    <REMARK type="arbitrary_data">0;527.41</REMARK>

    so I tried to just add the 0; in front of the $order->get_item_total( $item_data, false ),

    like this

    'REMARK' => array(
    					'@attributes' => array( 'type' => 'arbitrary_data' ),
    					'0;'$order->get_item_total( $item_data, false ),
    				),

    But that Ends in an errormessage, any one got an Idea how i can add the 0;


    0 0

    I'm running a private internal site that only registered users are allowed to view and use. I'm using the Jonradio Private Site plugin to help with the privacy.

    Currently, all of the registered users (except me as the admin) need to have their comments approved, which I don't want. All of the settings are correct (allow people to post comments, unchecked manual approval and previously approved comment). I thought the Private Site plugin might be the problem, but I've deactivated it and still have the same issue.

    I've tried going into the core code in wp-includes/comment.php and putting something along the lines of

    if ( 1 == 1 ) {
    $approved = 1;
    }

    at the beginning of almost every function, including wp_allow_comment, wp_new_comment, and check_comment just to try to get any non-admin comment published without needing to be approved. Nothing works. Am I missing something or do you think it could still be the Private Site plugin messing things up even though it's deactivated?

    Since there's only a relatively small list of users, I'm happy to create a whitelist of sorts so user comments get auto-approved. Something like:

    if ($author == 'username1'
    || $author == 'username2') {
    $approved = 1;
    }

    but at this point I can't get anything auto-approved, let alone specific users.


    0 0

    Hi

    Is there a way to make a php.ini adjustment to allow for non-ascii characters in FILTER_VALIDATE_URL, as I am running a site with PHP7 and it doesn't recognise é etc in a form that has a URL added with these characters.

    I'm not a programmer, so any help would be useful. A fix would be great.


    0 0

    I'm slowly wrapping my head around the new responsive images features in WP 4.4. I've got it fairly well figured out now for our CPTs & default page/post content images.

    - But is there a way to have the new WP srcset & sizes attributes added to an image placed in a standard Text widget??

    We could hard-code all of the extra data in the widget, but that would just be unwieldy to deal with and/or make updates to (there will be quite a few of them). Hoping there is a function or something that could replace a standard <img src="full-size-original.jpg"> with all of the srcset & sizes attributes as happens with images placed in content editor.

    And ideally it might be nice to know how to modify the sizes attribute if needed. We were able to find something for post thumbnails, but not sure it would work here.

    THANKS!


    0 0

    I have written a customer plugin that has a admin page that allows you to enter text and save it to a custom table. When i enter text like ["Hello"] it adds a \ infront of each ".

    does anyone have any ideas why and how to fix?

    I can provide code snips if needed.

    Thanks in advanace.


    0 0

    I have a some categories set up like so:

    Age
    Child
    Teen
    Adult
    Language
    English
    Spanish
    French
    Where Age and Language are parent categories, and those following are child categories.

    Relevant code below:

    $cat = (isset($_GET['cat'])) ? $_GET['cat'] : 0;
    $args = array(
                'tax_query' => array(
                    array(
                        'taxonomy' => 'tribe_events_cat',
                        'field' => 'id',
                        'terms' => $cat,
                    ),
    
                )
        );
        $my_query = new WP_Query($args);

    Right if I choose Child and Teen it will display all posts tagged with Child OR Teen, which is desired. But if I also choose Spanish, it will display events tagged with Child OR Teen OR Spanish.

    How can I fix my query so that if I choose Child and Spanish, it will pull posts tagged with Child AND Spanish instead of posts tagged with Child OR Spanish?


    0 0

    Hi

    I need a mysql query to show all products by a category

    here is a example of something I need , but i have issues on my where clause
    any body know how to fix this ?
    
    SELECT wp_posts.* FROM wp_term_relationships
    LEFT JOIN wp_posts ON wp_term_relationships.object_id = wp_posts.ID
    LEFT JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
    LEFT JOIN wp_terms ON wp_terms.term_id = wp_term_relationships.term_taxonomy_id
    WHERE post_type = ‘product’ AND taxonomy = ‘product_cat’
    where wp_term_taxonomy.term_taxonomy_id = 18

    0 0

    Hi,

    I installed a plugin which displays recent instagram posts by typing [instagram-feed] into a blog post

    But I want the recent instagram images on specific pages, not blog posts

    How would I insert this into the html code (I am building a theme from scratch)

    I tried <?php [instagram-feed] ?> obviously this didn't work but you get what I'm trying to do!

    Thanks


    0 0

    Hi,

    I've got a performance problem in my theme. I like to add MANY functions to change colors, fonts and so on. In this way I need for every option a setting in the $wp_customize array. But adding one setting will take 0.004 - 0.005 seconds (recorded local and not on a webserver). Multiplied by 50-100+ add_settings will cost performance and time of page-loading. In this way I got a warning for "not answering scripts". Yes, I could extend the time allowed for scripts to take, but this won't solve my primary performance problem

    Is there any posibility to store this settings in a file or database, so while reloading the page, not every setting have to be recreated? I didn't find a way to get all settings or to set them all at once. So I couldn't save it like the defaults for my theme_mods.

    I just found the possibility to add on setting at time via add_setting( $id, $args). Are there any possibilities for caching or something like this?

    Do you have any other suggestions getting a better performance by using many settings in my theme options?

    Thank you


    0 0

    Hello.

    Working on a plugin that adds a submenu page that requires query args, so I decided to hide it in the menu and just allow direct links.

    Hiding it with remove_submenu_page works great, but as soon as I do that I get a permission insufficient error when trying to access it.

    Site admin and the page requires manage_options capabilities.

    Any idea what I could do, except hiding it with CSS? Don't find that to be a nice solution since it leaves unneeded elements in the doc.


    0 0

    Is there an add_filter or an add_action where you can see/modify all the $POST data submitted for a new user registration?

    Thanks


    0 0

    Hi there,

    I'm working on my first plugin. It should have 2 pages with menus (i have them done with HTML form, Knockout for front-end and AJAX for back-end).

    For my first one i did (among others):

      Plugin file:
    • add shortcode to call function A
    • require File A
      File A.php:
    • Enqueue JS file with menu (JS and Knockout stuff)
    • Localize ajaxurl to that JS (for AJAX calls)
    • add AJAX actions
    • AJAX functions (php)
    • function A() { (...) echo $menu; } // HTML form

    This works... The problem is 'enqueue scripts' must be called outside shortcode function, so scripts are loaded in every page.

    So, the question i should did some time ago is: what's the best way to place my custom form as page content? (consider it need to execute JS and PHP)
    Where should i add actions, enqueue scripts,...?

    Thanks


    0 0

    Theme: Grand College V 1.10
    WordPress:4.5.2
    Affected page: http://learnfiberoptic.com/directory/

    I've made custom changes to my membership directory using a custom module in the paid-memberships-pro folder in my theme's directory. I can't figure out what is causing the sidebar to show at the bottom. I appreciate any help. I've been able to determine it's something in themes
    \grandcollege-v1-10\paid-memberships-pro\register-helper\directory php file.

    https://wordpress.org/plugins/pmpro-register-helper/


older | 1 | .... | 387 | 388 | (Page 389) | 390 | 391 | .... | 413 | newer