Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

schmedia on "Adding a term globally to a custom-tax belonging to a CPT"

$
0
0

I have a custom post type ('prompts') with an associated custom tax ('storytellers'). I've written a function (in the theme's functions.php) that should add a newly-created storyteller's username to the taxonomy for all prompts. Except it doesn't, yet. Here's the code:

// APPEND USERNAME to all global PROMPTS' STORYTELLER taxonomy
function append_new_teller_to_cpt_prompts_tax_tellers( $username ) {
	// The Query
	$args = array(
	'post_type' 			=> 'prompts',
	'pagination'			=> false,
	'category_name'			=> 'how-to-videos',
	'posts_per_page'		=> '-1',
	'fields'				=> 'ids',
	);
	$query = new WP_Query( $args );

	// The Loop
	if ( $query->have_posts() ) {
		foreach ( $query as $post ) {
			$the_ID = $post->ID;
			wp_set_object_terms( $the_ID, $username, 'storytellers', true );
			}
		}
	/* Restore original Post Data */
	wp_reset_postdata();
	}

Anyone see an easily-remedied problem here? I've tried tweaking a bunch of stuff, but so far no dice.


Chad Smith on "Woocommerce 2.4.7 - Display More Variaitons"

$
0
0

Hey -

I'm on WP 4.3.1 with WooCommerce 2.4.7.

I would like to see more than 15 variations in the admin; I want to see 50.

I have placed this code in my theme's functions.php file:

function custom_wc_ajax_variation_threshold( $qty, $product ) {
	return 50;
}

add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 50, 2 );

It isn't working.

Can anyone help -has anyone seen a similar issue?

Thanks for reading - I'll keep looking and post if I find the answer.
-Chad

HaukeNI on "Removing title link of custom post type"

$
0
0

Hi,

First off, I'm fairly new to WordPress development. I know my way around the GUI part pretty well but I'm not yet well versed on the php end. So if you reply, please be specific. Most importantly, please tell me what file the code should go into and where it's located. In the vast majority of answers I've found here I just see chunks of code pasted and I usually have no clue where it's supposed to go.

So here's what I would like to accomplish: I have created a custom post type "Dealer" that is being displayed as a list of search results. By default, each "Dealer" title is a link directing to the single post page. I do not want the titles to be links, since the single pages are irrelevant and shouldn't be accessed. I did find threads in the forum describing how to remove the anchor tags from all posts globally but I have not found any describing how to do it just for a specific custom post type but if one exists, feel free to just link me to that.

wpuser131 on "Using a "load more" button"

$
0
0

Hello everyone. I hope I am posting at the correct category.

<div class="container">
  <?php foreach ( $myPosts as $post ) : setup_postdata( $post ); ?>
	<div class="thumbnail"><a href="<?php the_permalink(); ?>">
	<?php the_post_thumbnail('thumbnail' , array( 'class'	=> "aligncenter"));
         ?>
                <div class="image-title"><?php the_title(); ?></div>
	    </a>
        </div>
  <?php endforeach;
        wp_reset_postdata(); ?>
</div>

Well the above code, creates a container, in which all the posts of a specific category are shown (this is addressed when I create $myPosts and works fine). The result is fine, but obviously when the posts of a category are too many, the load page time increases. So I was thinking of using a "load more" button.

1st question: Is this the appropriate way of reducing the page load time in this case?

2nd question: How can I do this? I couldnt find an appropriate plugin, for this specific case, as I am showing the posts with my own code, without using a "posts page" or smth. If there is one and I haven't noticed, then you 're most welcome.

Thanks!

team-ac-realty on "Dashboard menu"

$
0
0

Hello World
The theme author is missing in action for months now...
I have an issue with my admin menu
I had an incompetent designer who hid the agent function in my sites dashboard because it was interfering with the plugin I have which also has an agent function. Now I need to bring it back but it appears to be disabled. Does anyone know how to re enable it?
Please see attached photo for more details in this link!
Any help would be amazing.
Thanks in advance!
Chris

stevebar84 on "get_the_date function for specific post ID"

$
0
0

Hi,

right, this is the new problem that is keeping me up all night.

i have created a function which allows me to get the date that a post was published, and i've created a shortcode so i can call it in the visual editor.

function thedate(){
return get_the_date('F jS,');
}
add_shortcode('date', 'thedate');

so i then do the [date] shortcode in the visual editor and when i load the page it shows the date that page/post was first published.

great.

except that i want to display the date that a DIFFERENT post was published.

ie, i'd type [date id='243'] and the page would display the date that the post with id 243 was first published rather than the date of the page the shortcode is written in.

any ideas? i feel like i've tried everything!

abhinavbalajee on "Using WordPress User Details outside Directory"

$
0
0

I have a PHP Web App in which I want to use some User Details from WordPress installed inside a Folder.
Suppose My App will be inside ===>>> http://www.example.com
and my WordPress install will be inside ===>>> http://www.example.com/membership.
Basically I will check if User is Logged-In in WordPress and use some values
from WordPress Database to restrict Few Settings in my Web App.
I anyways need WordPress for Blogging purpose so thinking of using its User
Registration and Log-In module as well. Possible ?

mobnew on "Load dynamic content in dropdown menu"

$
0
0

I apologize if this is in the wrong section.

I am looking for a way to load dynamic content into a dropdown menu, such as alerts relative to the logged in user.

Any help is greatly appreciated.


Robert Stockwell on "Register user without email address"

$
0
0

When creating a user in WordPress an email address is required for each user. The website I'm working on requires that users remain anonymous (it's part of a cancer research study) and email is an identifying piece of data. Users will be self-registered and I am using Gravity Forms. Ultimately, the only information they will provide is a unique username and password.

Am I going to have to provide a fake email address for each account, or is there a way to leave this field blank?

What I want to do is very similar to this: http://wordpress.stackexchange.com/questions/22754/user-without-email

Except the code here broke my site. Any info/insight is appreciated.

prasun1519 on "Getting warning for meta.php file"

$
0
0

Hi,

I migrated site from one host to another via Wordpress Importer and receiving error on the following page:
http://e44.91d.myftpupload.com/patient-testimonials/

Error is as following:
Warning: trim() expects parameter 1 to be string, array given in /home/content/p3pnexwpnas10_data01/44/2839944/html/wp-includes/meta.php on line 1442

I tried all possible way, like disabling Themes and Plugins and enabling them one by one. But the problem still persists.

Can anyone help me ASAP pleas?

Thanks in advance.

Regards
Prasun

dimig on "Copying styling/formatting from one widget to another"

$
0
0

Hello again.

I've created a new widget area above my site's header, and I'm having trouble styling it.

I want the text and formatting of the widget to look like it does in the footer. I tried to use the original CSS mutatis mutandis, but I couldn't get it to work. Would someone tell me where to look and how to target the relevant parts of the pre-header widget?

My site is here: http://pla.za.com

whoamianyway on "A single tag archive in a static page?"

$
0
0

Hi. I have the Modern Tribe Events Calendar, which we use to advertise training courses and would like to do the following.

Create a static page for all courses run by a certain person. All these courses have a single tag in common ('sum'). I would like the tag archive for the 'sum' tag to appear in a static page that I can rename (so it's not called 'tag archive') but I don't want to change the titles of all other tag archive pages, so don't want to mess with archive.php.

Is there a straightforward way to do this?

Thank you!

andreafebrian on "looking for plugion that visitor can submit form and receive unique codes/number"

$
0
0

hi guys i'm looking for a plugin that can do this kind of things

-visitors (no need to register to our site first) are able to submit their personal information such as name, address, contact, email, etc
-when they submit their data, they will get unique code/number. same user can submit their info and data as many as they want, but the code/number must be different each time.
- only admin can see their data.

anyone of you know plugin that can do such a thing?

Thank you.

nikhilnaik on "Modification of bbpress forum “Auto Subscribe” code snippet"

$
0
0

I wanted to seek help in modifying the following piece of code. I have a site with buddypress groups inside which I have bbpress forums for the respective groups. I want the users of the group to be automatically subscribed to the forums within that group. I tried the following code:

add_filter( 'bbp_get_user_subscribe_link', 'invert_get_user_subscribe_link', 10, 4 ); //invert forum subscription
add_filter( 'bbp_is_user_subscribed_to_forum', 'invert_is_user_subscribed_to_forum', 10, 4 ); //invert forum subscription
add_filter( 'bbp_get_forum_subscribers', 'invert_get_forum_subscribers' ); //invert forum subscription
add_filter( 'bbp_is_user_subscribed', 'invert_is_user_subscribed', 10, 4 ); //invert forum subscription

function invert_is_user_subscribed($retval, $user_id, $object_id, $subscribed_ids) {
    if (get_post_type( $object_id ) == bbp_get_forum_post_type())
        return !$retval;
    else
        return $retval;
}

    function strContains($needle, $haystack) {
    if (strpos($haystack, $needle) !== false) {
        return true;
    } else {
        return false;
    }
}

    function invert_get_user_subscribe_link ($html, $r, $user_id, $topic_id) {
    if (strContains( "bbp_unsubscribe", $html )) {
        $html = str_replace("bbp_unsubscribe", "bbp_subscribe", $html);
    } else {
        $html = str_replace("bbp_subscribe", "bbp_unsubscribe", $html);
    }
    return $html;
}

    function invert_get_forum_subscribers( $users ) {
    $args = array('fields' => 'id');
    $all_users = get_users($args);
    $send_to_users    = array_diff($all_users, $users);
    return $send_to_users;
}
    function invert_is_user_subscribed_to_forum( $retval, $user_id, $forum_id, $subscribed_ids ) {
    return !$retval;
}

But there is a problem. Using the following code leads to the user getting subscribed to all the forums of all the groups (even those which they aren't a part of). I just want them to be automatically subscribed to those forum topics created inside the group which they are a part of. Kindly help me in getting this right.

Posting it here as I did not get response over at bbpress.

Thanks!

Phil on "Plugin slug/name character length limits"

$
0
0

When submitting a plugin to the official WP plugin repo, is there a minimum character limit for the plugin's slug/name? For example, would a plugin be allowed to have a directory of:

/wp-content/plugins/hi/hi.php

Or would this be deemed too short?

I had a look in the docs but couldn't see anything on the topic.

(I'm not actually proposing to create a "hi" plugin)


josheby on "Allow Authors to Edit Pages If They Are the Page Author"

$
0
0

I am looking for some insight into what will be needed to make it so that the Author role will be able to edit pages "IF" they are the page author. So if they are not the author of any pages, nothing would be available.

Any thoughts or insight would be greatly appreciated! Thank you everyone.

Ciredor on "Duplicate default gallery creator ?"

$
0
0

I have slider plugin in form of shortcode that's very similar to default gallery, using the same parameters (other than columns). So when i want to create one i use default gallery creator and simply change part of generated shortcode from [gallery... to [slider...

Is it possible to duplicate that gallery creator changing just name and shortcode output name ?

Or adding some kind of dropdown to select shortcode name output only ?

boybawang on "Displaying sensitive info in admin section"

$
0
0

I'm developing a plugin that requires a third party API key. I have a few questions regarding best practices for storing the API key in the DB and displaying it in the admin section.

1.) Is it ok to store the API key as cleartext in the DB, or do I need to encrypt it?

2.) Is it OK to display the API key in the Admin section after it's been saved?

3.) If 'yes' to #2, If should I make sure that the user is the 'Super Admin' before displaying the key?

Any other advice is greatly appreciated. Thanks!

say_hello on "add some shortcode - eg. of a plugin - into a slider"

$
0
0

hello dear community,

can i add some shortcode - eg. of a plugin - into a slider ?
is this doable?

note: i want to combine an

advanced-iframe-plugin with
a slide-in plugin

is this doable

rodwarrix on "Bulk Assign Featured Images To Pages/Posts?"

$
0
0

Hello, I am trying to ask how to bulk assign Images to pages and posts. I know I seen lots of mysql inserting but when I try to understand post id it seems like it be to hard to do that way but is it possible to use something relative like post title to assign the images. Post Id seems like I'd have to know alot about how it's assigned in the SQL database rather then me understanding I have a page named "My Page" and want "My Image.jpg" assigned to it. Now what I am doing is I have 200 + pages 160 of them no featured images assigned to them yet (few hours or days, weeks to do!) to insert what pages and the images I want set as their assigned featured image. Any one know how to do this? I have few sites that this would be soooo great to use it for saving me time to do other things.

Viewing all 8245 articles
Browse latest View live




Latest Images