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

Dervila on "Need hook which fires when user hits "trash" button on custom post"

0
0

I need to run a function right after the user hits the "trash" button on a custom post. {$old_status}_{$new_status} won't help because those and their relations fire after the custom post is trashed. I need the function to run before the custom post is trashed.

Here's the detailed explanation: I have a list of members of a group, where the member custom post was created with the Pods plugin. My users are members of that group, and so have access to the list so they can create/modify/delete their data. Some of my users are barely computer literate, and easily confused. I don't want a user trashing someone else's post When a user hits the "trash" button on a given member custom post, I hope to run a function that compare's the current user's user id to the member post's user id. If they don't match, access will be denied.

I have looked all over the WordPress site, and even looked through the hooks listed for WordPress 3.9 on Adam Brown's site. I'm afraid I'm stuck.


rafamadrile on "obtener variables get url wordpress"

0
0

Buenas.

Tengo un problema un poco complejo de explicar. Estoy montando un wordpress donde tengo una pagina (galerias), con una serie de fotos. Los enlaces permanentes estan configurados como "Nombre entrada". Para acceder a esta pagina la url es

http://www.midominio.com/galerias.

Lo que estoy intentando es pasar dos variables get con una estructura tipo
http://www.midominio.com/galerias/variable1/variable2

He realizado algunas pruebas en htaccess que no han funcionado.

RewriteRule ^galerias/([a-zA-Z0-9-]+)/([0-9]+)$ galerias/c=$1&f=$2 [L,NC]
- No se encontro la pagina
- se mantiene la url

RewriteRule ^galerias/([a-zA-Z0-9-]+)/([0-9]+)$ galerias/index.php?c=$1&f=$2 [L,NC]
- No se encontro la pagina pero llegan las variables
- se mantiene la url

RewriteRule ^galerias/([a-zA-Z0-9-]+)/([0-9]+)$ index.php?p=27c=$1&f=$2 [L,NC]
- Llega a la pagina galerias pero no llegan las variables
- redirije a http://www.midominio.com/galerias

Por anticipado,
Muchas gracias.

jqz on "Bad P elements added by shortcode processor??"

0
0

I am not sure how, as I've looked at the code in shortcodes.php and can't see how they could be creeping in.

I've eliminated and processed the unwanted P elements as indicated at http://wordpress.stackexchange.com/questions/49077/shortcode-from-a-widget-is-wrapped-in-unwanted-p-element/

But I am finding the content of the shortcode is often immediately prefixed by </p> and immdediately postfixed by <p>, which end up being unmatched tags and cause undesirable results.

What code is adding these tags, and how should I disable it?

Note1: If I do not follow the suggestions from the link above, there are still unmatched P tags, and the result is generally worse.

Note2: I am using nested shortcodes.

Tim Brugman on "Adding links to internal pages by id"

0
0

Hi. This is my first discussion thread on WordPress functionality so let me know if this is not the right place or if I'm doing something wrong.

The other day I ran one of those online website optimizer tools on a client site of mine. One of the problems that came up was that the client filled the site with content on its staging platform and thus inside the body he had created permalinks to the staging site. When we launched the site I copied the database and taa-daa, the live site was linking to staging. Simple problem.

Plugins
Now there's plenty of plugins that can provide a solution. All of them create a shortcode, and most add a button to TinyMCE or some other new UI element so the user doesn't have to look up the id and post type of the post they want to link to and can link anything they want.

Pros: It works.
Cons: None of them add the UI to the existing 'insert/edit link' interface. That means I have to explicitly tell my client how to use it, and he has to remember to tell any and every moderator he adds. Or I have to remove the default TinyMCE buttons so there can be no confusion. Side question: Can the 'insert/edit link' window be modified with hooks?

Index.php
The documentation provides a solution as well. We could link to index.php?p=6 or index.php?cat=7 or index.php?page_id=42 etc. I assume this also works with post types.

Pros: It works. No plugins needed.
Cons: There is no interface to make this easy for the user. A plugin would have to be made. The links also get published, so yes they work - but Google wont get to index your pretty permalinks.

Add it to core?
This I have no experience with. I couldn't find any places where this might have already been discussed in the past.

Arguments for:
I think it would be a good change to the way links work. Divide the interface into internal and external right away, when the user chooses internal the interface will generate a shortcode with the chosen target's id and post type. This would also require the core to process this shortcode by default, similar to the more-tag.
A posts' id and type are the only things that will always remain the same. It would make sense to use those to connect pages together instead of hoping nobody will change a linked posts' slug.

Arguments against:
When we change all internal links in post bodies with shortcodes it will undoubtedly require some extra queries so turn those into permalinks before spitting it out on the front end. Maybe this is not lean enough for core.
Only a small portion of WordPress users will be working with different environments. My reason for wanting this is maybe not big enough for a core addition.
This feature could also help when you change the base URL of your website. This should however also happen rarely so they same 'not enough demand' argument applies.

So those are my 2c on this tiny but integral subject. To summarize: Linking internally by id seems better to me. The existing plugins are not perfect. I don't know if a perfect plugin can be made for this and I don't know if this is a change worthy of suggesting for core.

I'd love to hear what you think.

Dervila on "Need hook which fires when user hits "edit" button on custom post"

0
0

I need to run a function right after the user clicks "edit" on a custom post. {$old_status}_{$new_status} won't help because those and their relations fire after the custom post is edited. I need the function to run before the custom post is edited

Here's the detailed explanation: I have a list of members of a group, where the member custom post was created with the Pods plugin. My users are members of that group, and so have access to the list so they can create/modify/delete their data. Some of my users are barely computer literate, and easily confused. I don't want a user editing someone else's member data by mistake. So I want to compare the current user's user id to the member post's user id to make sure they match. If they don't, the user is denied access.

I have looked all over the WordPress site, and even looked through the hooks listed for WordPress 3.9 on Adam Brown's site. I'm afraid I'm stuck.

tiofelix on "I'm trying to create a solution to upload images outside the wordpress server"

0
0

I'm not sure if this is the correct section of the forum to ask this but if i'm mistaken, please tell me where i should go and i can post it on the correct section.

I have a wp MU with many subsites, and on each subsite, people upload lots of images, everyday.

At this point you probably already guessed the server disk space won't handle it forever. The thing is... i can't also limit a "max space usage" on the network dashboard because their websites news must be updated almost everytime, and new pics come in.

Now, i'm trying to find (or maybe even create) a plugin which allows the user to upload the pictures on a image sharing service, but using the wordpress dashboard.

I've been using this old Wordpress Flickr Manager plugin for about 1 year or so. It kinda does its work fine, and we bought a premium account on flickr so basically we have unlimited space.

But this plugin is also old now, the author doesn't seem interested to update it, and i even had to do a url fix on the phpFlickr library it uses since Flickr changed their REST API urls.

So i ask for any ideas towards this problem. I can't find another flickr plugin that uploads through wp, neither have an idea of a better solution. Maybe another image sharing service? Maybe even a brand new approach to the problem? I'm out of ideas, and i appreciate any suggestion.

Thanks!

acrane on "Search Taxonomy terms not posts"

0
0

I want to generate a list of Custom Taxonomy terms, through the searchform. I don't need to return posts associated the the term, I want to return the terms themselves that will link to get_term_link()

Hamesy on "Soundcloud to thumbnail"


mortrza1371 on "new rich text editor in admin"

0
0

I use Following functions to add new new rich text editor in admin .

add_action( 'add_meta_boxes', 'adding_new_metaabox' );
function adding_new_metaabox()
{
    add_meta_box('html_myid_61_section', 'ویژگی ها', 'my_output_function');
}

function my_output_function( $post )
{
//so, dont ned to use esc_attr in front of get_post_meta
$valueeee2=  get_post_meta($_GET['post'], 'PLUGIN_VALUE' , true ) ;
 wp_editor( htmlspecialchars_decode($valueeee2), 'mettaabox_ID_stylee', $settings = array('textarea_name'=>'MyInputNAME') );
}

function save_my_postdata( $post_id )
{
if (!empty($_POST['MyInputNAME']))
    {
    $datta=htmlspecialchars($_POST['MyInputNAME']);
    update_post_meta($post_id, 'PLUGIN_VALUE', $datta );
    }
  }
 add_action( 'save_post', 'save_my_postdata' );

and use thise code to display content in the template.

<?php echo get_post_meta($post->ID, "PLUGIN_VALUE", true);?>
but can't display clean content in the post.

see

  • Can't
  • Display
  • good

I don't want display tags.

I want display only content

see

Can't
Display
good

Webmaster_crawl on "Page Load and Scroll from right to left"

0
0

I would like a wordpress page to load in background, then scroll right to left and come in viewport..

For example please see this link https://www.dropbox.com/guide/admin

On click of any link, the next page loads in background.. and the progress is shown on top, and then the page comes in viewport from right to left.

The question is, i can apply jquery to have that scroling effect, but that wud be possible when i have page already loaded but out of current viewport.

So how can i tweak to have the pages behave something like in above link ?? any pointer?
Thanks

DanUnion on "Query number of posts in search result and load content accordingly"

0
0

Hi there,

wondering if someone could help.

On my search results page i currently have this code, which loads a content template for the posts when it finds posts, or if no posts are found, loads a different template.

<?php if ( have_posts() ) : ?>
		<?php /* Start the Loop */ ?>
		<?php while ( have_posts() ) : the_post(); ?>
			<?php get_template_part( 'content', 'grid' ); ?>
		<?php endwhile; ?>

		<?php else : ?>
			<?php get_template_part( 'content', 'none' ); ?>
<?php endif; // end have_posts() check ?>

What im wanting to do though, is display content templates depending on how many posts are returned in a search. So if there are 7 or less posts returned, it uses one template for each post displayed, and if there are more than 7 posts, it uses a different template.

Ive taken a look at using:

$posts = get_posts();
$count = count($posts);

and when i echo $count, it seems to show the number of returned posts, however for the life of me i cant seem to build a query on the returned number of posts into the loop, any help would be much appreciated!!

DrMosko on "HELLO, i NEED TO KNOW IS IFRAME FROM WORDPRESS SITE REMAIN IN WORDPRESS?"

0
0

WHAT I SEE IS THE IFRAME NOT GETTING COMMAND LINE PLUGIN_DIR_PATH,
i'M TRYING TO GET THE DATA FROM THE IFRAME INTO THE WORDPRESS SITE , HANDLE IT AND SEND IT BACK AGAIN TO THE IFRAME - HOW DO I DO THAT, ANY SUGGESTION WILL BE KUNDLU ACCEPTED

robertsmith on "My Blog "Gmail Customer Service 1-866-441-4509""

0
0

HI

My Bog Gmail Customer Service 1-866-441-4509.wordpress.com has been removed i don't know what is the problem.

serj.stratu on "wordpress render gallery html"

0
0

Hello guys
i want rewrite my galery html instead of the standard.

now i have this html

<dl class="gallery-item">
<dt class="gallery-icon landscape">
<a href="{image url}"></a>
</dt></dl>

but i want this html in gallery

<a href="{full_URL}" title="{TITLE}" data-thumbnail="{THUMBNAIL_URL}" data-description="{DESCRIPTION}">

Dervila on "Changing permalink in code"

0
0

I would like to change the permalinks for all custom posts of a certain type in a program. I have the hook I need, the function works, I see how to get the permalink, but I don't see how to change the permalink in a program.


tihomirmat on "Redirect to thank you page after submit"

0
0

I am trying to redirect users to THANK YOU page after submitting. I use default theme contact form. I'm a complete novice and don't know how to make it work.

http://tetefinance.si/kontakt/

Thank you for your answer

carlitocenteno on "Add additional classes to wp-caption"

0
0

Currently, wp-caption gets classes such as "aligncenter." However, I'd like to add the size-specific classes that the image gets, e.g. "size-medium," etc. This will give me the ability to target it for responsive purposes. Is there a way to do that via functions.php?

joshjosh on "Play Audio Reading of Text of Post and Have The Text Transform As It Is Read?"

0
0

Hello. Can anyone perhaps point me in the right direction about how I could play an audio reading of the text of a post, and have the words transform (change color, underline, bold, etc.,) as they are read, in-time or in-sync? I'm not sure what I need to learn in order to be able to do this. Any advice would be sincerely appreciated. Thanks!

David M. on "Unregister a widget area without id"

0
0

I want to unregister a widget area provided by a parent theme. This is what the Codex advises:

<?php unregister_sidebar( $id ); ?>

And this is how the parent theme registers the sidebar:

register_sidebar(array(
	'name' => 'Pages Sidebar',
	'description' => esc_html__('A widget area', 'parent-theme'),
));

unregister_sidebar works with the id, but the theme registers the sidebar without an id. What can I do to unregister that? Is there a default id, and how could I find it out?

Thanks!

joshjosh on "Permanently hide post from logged-in user once user has viewed it a single time?"

0
0

Hello, all. I'm looking for a methodology that would result in a post being permanently hidden from a specific user who logs-in and views the post once. I want the post to disappear after the user has left the page, or after a specified period of time after the post has been viewed. Any ideas?

Alternatively, allowing the user to click a button to hide the post permanently would also suffice.

Josh

Viewing all 8245 articles
Browse latest View live




Latest Images