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

stanyy on "Update_post_meta"

$
0
0

Quick question. Is update_post_meta done on the fly, or does it permanently store the value in the database?


Giu Tae Kim on "Disable default author website url sanitization in comments"

$
0
0

Hello!

I created my custom function to sanitize and validate a visitor comment data to insert it to database using the "wp_insert_comment" hook. Everything ok!

But as long I really don't care about the visitor website, I though about using that field to other useful information. So I decided to let the visitor specify their city/country name using that field. Also the website field is visible in comments moderation in admin area to quickly modify as I wish. That was very useful for me.

Here the problem starts. I don't know why but Wordpress forces the author website url field to be a url! Yeah... I know that it should behave like that, but I suppose that the wp_insert_comment hook doesn't make any kind of sanitization or validation (that's the reason wp recomment wp_new_comment).

Wordpres adds "http://" in the text, and all spaces became "%20"! That looks horrible in my case... I.E: "New York, USA" looks like "http://New%20York,%20USA"

Is there some way to disable this only in author websites fields in comments?

Regards!

vijiatcap1 on "Routing comments to a different database"

$
0
0

Hi,

I have a secure site with admin behind a secure subnet. I am offloading media, assets to public S3 bucket using Offload S3 paid plugin. I have a read replica of the Admin DB that is connected to the customer facing WAF and EC2 servers.

I would like to enable commenting for this site. Now that the customer facing site only has a read only database associated with it, I would like to see what options I have. How about we expose an API that takes comments and posts to a service that can write to the Admin database?

Is there a better option?

filesubmit on "How to add NPS to every post"

$
0
0

Hello,

is there a plugin to measure the Net promoters score for every single post?

DenisCGN on "Get exact CPT from the authorID"

$
0
0

Hello,

I need some help to get the exact 1 CPT "artist" URL from an author ID.

The goal is to change the author_link to this custom post type "artist" of the author.

I allready got the author ID and I know how to change the author link by using the author_link filter.

So, how do I get the custom post type "artist" URL where the author ID is $global ID.

I know I can do this by customize a query, but, cause there is only ONE cpt for each author I am looking for some shorter way to get this URL or PERMALINK.
die
Thanks for help,
Cheers,
Denis

jockebq on "Hide fields from WooCommerce add product page"

$
0
0

Hi,

I'm making our site more friendly to our employers which will add new products.
There are a lot we don't need from WooCommerce as we use it in Catalog mode.

One thing is the following.
I have disabled all product types except External product. And disabled a few tabs from external products.

What I want to hide/remove is the following:
http://imgur.com/xpMvCHu

In the blue box.
I want to hide or remove Regular price and Sale price and Schedule.

Can anyone help me make a code snippet I can put in functions.php?

Thank you!

Taro on "Search result based on menu category"

$
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

ferocious on "Problem with Costum Post Type"

$
0
0

Hello, I followed the instructions from the Plugin Handbook about how to create Custom Post Types. My plugin creates a new CPT "Tale" that gets a new top-level administrative screen and it's shown in its own top level menu so I can manage this post type, but it's not seen by other plugins such as "Custom Post Type UI" and "Members". Why?


MB Creation on "network_site_new_form usage"

$
0
0

Hi,

Simple question for "mutlisite install" :

I would like to add input to the "create a new site" form in the network admin area.
Since 4.5 there is a hook called "network_site_new_form" which is perfect to ouput new html in to the form.

But i can't find any other hook to handle possible new POST data i might have if i had field to the form.

Any help appreciated :)

Benoit

tcloud on "pull posts from bulletin board to WordPress"

$
0
0

I currently use a facebook feed plugin to pull posts from our Association's facebook page.
http://cloud-assn.org

We have a bulletin board at rootsweb dedicated to our genealogy research and I'd like to list posts to it in a similar fashion to the facebook plugin:
http://boards.ancestry.com/surnames.cloud/mb.ashx

The above link to the bulletin board has a link for an RSS feed, but it doesn't appear to work any longer, so any code would have to read the page and pull the topics from it.

Any suggestions appreciated.

thanks,
Tom

Steve on "Ignore/Delete Post"

Thelaith5 on "[X-Post from Plugin forum] Swapping between two instances of the same widget"

$
0
0

Hi, i am trying to find out whether this is possible or not - i am not a fluent coder, but i know how to read and somewhat edit in CSS and a bit of PHP.

I am a leader in a guild in WoW, and we're a big guild, so we want to have two raid teams, however if i put two times this widget in the right sidebar it'll look ridiculous.

My question is whether it's possible to do some hack or modification so i can swap between them, perhaps in a dropdown menu or have them fold/unfold?

Here's the website: http://empathy-eu.com/ - i am talking about the place where it says "Recruitment for Apocalypse" and the icons and text below it. It is this plugin: https://da.wordpress.org/plugins/world-of-warcraft-recruitment-widget/screenshots/ - I've modified it a bit to add some new stuff as well as edit out some ugly colours and whatnot. Any help is appreciated.

cmpe on "Is there a way to override or map WP_User ?"

$
0
0

Hi all, on my first adventure in WP plugin development and need some guidance and expertise from the gurus. I've made some headway into integrating Wordpress with another PHP app with the intent to use Wordpress as a CMS.

I'm a little torn on what strategy to use for integrating the userbases of the two platforms.

For right now, I'm essentially just running wp_create_user and storing redundant information in the WP database which includes user metadata that syncs with the user ID of the other app. However, the idea of keeping two copies of essentially same data bugs me.

So I'm wondering what other strategies exist for user integration between systems.

Is there a way to "override" or custom map the WP_User where I can put an interface or filter in front of WP_user so that whenever Wordpress attempts to get user information, it goes through my custom interface so that I can manipulate the data as needed (and by this I mean just mapping the data from the other app to match what WP_User properties)?

I was thinking about extending WP_User class but then I'm still unsure how I could plug the new class into everything.

I was able to do this with comments by using the 'comments_array' filter to create my own stdClass object to return but I couldn't find any filters for the user data.

Appreciate any pointers! Thanks!

cfurrow on "Form on backend of post for placing text inside code"

$
0
0

Hello!
I'm currently setting up a new website for my church, which will involve the publishing of about 2000 teachings. We're doing that by pre-writing the code for the "teaching page" where the details and urls of the different teachings can essentially be filled in by the volunteers and then posted in a custom post type that will be filtered by users on the front end.

I'm trying to make this process a little simpler for our volunteers by finding a way to add some kind of form inside to the text editor of the custom post type, where they can just type the title, date, teacher, mp3 url, etc. into the fields and when the post is published it auto-fills our pre-written code for the "teaching page".

Does anybody know how this can be done? In addition, is there a way to then mass upload, maybe via a spreadsheet, all the details of the teachings into those fields, so each volunteer can maybe create their own spreadsheet of 100ish teachings and then just submit that to the website?

I've heard rumors of such mass populating techniques, but I have no idea how I might be able to do this.

Thanks to whoever takes the time to read this!

ferocious on "Add CPT submenu to profile"

$
0
0

Hello, I'm trying to add a submenu to the subscriber profile with his Content Post Type with a new role that has the available permission to "Add New". I'm passing the following args to register_post_type

'public' => true,
'hierarchical' => true,
'has_archive' => true,
'show_ui' => true,
'show_in_menu' => 'profile.php',
'show_in_nav_menus' => true,
'rewrite' => true,

but when I try to add a new post I get

"You do not have sufficient permissions to access this page

It only works if I remove 'show_in_menu' but it is not what I want that is 'Profile'->'Your profile','CPT submenu'. How do I fix that?


michaelpon12 on "post child contents by using current id"

$
0
0

I'm using this code to post the child pages of the said ID but basically I want to convert this dynamically by using the_ID but when I use the_ID it posts all of the pages and posts. Doing the <?php echo the_ID(); ?> display the current ID. Not quite sure on how can I used this to control the loop.

123 is the ID of the Parent this needs to be converted to the_ID().

<?php
			$args = array(
			    'post_type' => 'page',
			    'post_status' => 'publish',
			    'posts_per_page' => -1,
			    'post_parent' => 123,
			    'orderby'=> 'menu_order',
			    'order'=> 'asc',
			);
			$query = new WP_Query($args);
			$catNull = get_template_directory_uri();
			echo '<ul class="all-service">';
			while ($query->have_posts()) {
			    $query->the_post(); ?>
				<li class="all-service-item">
					<a href="<?php the_permalink(); ?>">
					<div class="content">
						<h4><?php the_title(); ?></h4>
						<?php the_content(); ?>
					</div></a>
				</li>
			    <?php
			}
			wp_reset_postdata();?>
			</ul>

Tremer on "Last user login function causes an error"

$
0
0

Hello,

I have the following function in my child theme function.php.

function user_last_login( $user_login, $user ){
    date_default_timezone_set("Europe/Berlin");
    $date = new \DateTime();
    $time = date_format($date, 'd.m.Y');
    update_user_meta( $user->ID, '_last_login', $time );
}
add_action( 'wp_login', 'user_last_login', 10, 2 );

It works fine but I receive the following error:

Warning: Missing argument 2 for user_last_login(), called in /...

What is the missing argument?

Many thanks in advance.

Regards
Michael

tib98 on "Change links to resources in the header of "accelerate" theme"

$
0
0

Hi everyone. In order to optimize the loading speed of my website made in Wordpress, I'm trying to remove some <link> tags in the header (like Google Font for Roboto and Font Awesome.css) of my accelerate theme. However, none of these links is in the header, so I really don't know what to do! Any suggestion?

zagreus on "Wizard not waiting for remote validation response"

$
0
0

I am trying to use a remote handler to validate that an email the user is submitting is not already used. This is as part of a wizard using the formtowizard plugin.

However, when i click Next on the wizard it does not wait for the asynchronous response to be returned and goes on to the next step. However, if i go back and wait for the response then it works fine and I cannot continue.

I have tried to force an sychnronous remote request however this is not working.

So the question is, how to make the remote validation check synchronous ...

Any help would be much appreciated

jQuery('#SignupForm').validate({
    rules: {
        email: {
            required: true,
            email: true,
            remote: {
                url: my.ajaxurl,
                async: false
            }
        }
    },
    errorPlacement: function (error, element) {
  // Show Error
    },
    errorElement: 'em',
    submitHandler: function (form) {
  // Handle submission
    }
});

TheHungryGeek on "Trigger only the first instance of add_action"

$
0
0

Hi,

I'm trying to use an action hook with my theme.

Unfortunately the action hook in question triggers at multiple instances on the page in question.

Is it possible to only insert code to the FIRST instance of the action hook in a page?

Thanks for the help!

Viewing all 8245 articles
Browse latest View live


Latest Images