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

leeheeman on "Access Plugin's UI From Frontend"

0
0

I have been looking around for a way to access the user interface of a plugin from the frontend of my website.

Normally, I would post any code and the website, but I really just need a push in the right direction. I have not found any documentation for how to do this specifically.

I can think of a few convoluted and resource consuming ways to do it, but I'd really like a simply way for users to access a particular plugin from the frontend.

I want to keep them out of the backend not for security reasons, but it's because I feel they would have a more seamless experience if they never had to go to the backend.


glenn.sjostrom on "Take advantage of the "Theme Details" interface?"

0
0

Hi!

Like the topic says: How can I take advantage of the Theme Details interface? You know the popup similar thing.

I have checked the source code in themes.php and its seams like its build with something with <script type="text/template">, that I can't figure out how its build. I have also tried the ThickBox but I don't find it working well, it's working different on every page. In the themes.php I found this code

add_thickbox();
wp_enqueue_script( 'theme' );
wp_enqueue_script( 'customize-loader' );

But I don't understand why they use add_thickbox, I cant see where they using it? The popup for Theme Details isn't build with ThickBox?

I'm building a plugin and I want to make a link in the admin_bar_menu referencing to an popup (with the Theme Details interface) on every page. Is this even possibly?

Spretor on "WordPress functions in plugin files"

0
0

Good day!
I have the following problem: in the main file plugin 'plugin-name.php' I can use WordPress functions (eg get_option ()), and can't do it in additional files, there is an error 'call to undefined function'.
How to act properly in this case?
Thanks!

vegastriguy on "Call custom PHP in Top Bar"

0
0

Many of the pro themes I implement now have a "TOP BAR' and I would like to implement a sunrise/sunscript reference towards the top right. On this particular theme, I can implement a widget and maybe put some html there....but, not sure how to "call" the script?

The PHP script could be found here: http://www.vegaspolarbeardip.com/weather/sunrise-sunset.php

here is a screen snag of where I would like to put it....

http://vegaspolarbeardip.com/sunrise.jpg

I post this on the various theme support forums, but, yep, you guessed...SORRY WE CANNOT HELP YOU. I am a designer not a coder but I suspect it is not too difficult but I am clueless.

Thanks in advance.

etoolsmith on "Daily/Weekly Digest Emails"

0
0

Hello All,
I am just wondering if there is a daily/weekly digest plugin that will allow users to subscribe via a widget and send daily/weekly digests of the site(including custom post types) to a user?

Please note the daily/weekly setting has to be set on a per user level and not a global site level.

Thanks

Kuckovic on "AJAX only deletes newest URL"

0
0

Hi all!

I have a little problem.
I'm developing a plugin, where I can add an URL and a name to my database, and it works perfectly.

Now, I put all my information in a table, and it works like a charm too!
Every URL has a "Delete" button, and here's where it goes wrong!

When I press the "Delete" button, it ONLY WORKS if I press the newest URL - if I press nr. 2 or nr. 3 on the list, it's not working??

Here's my code for the "Delete" button/form:

<div id="wcommentreminder_deleteform">
    <form action="" id="wcommentreminder-deleteform" method="POST">
    <input type="hidden" id="wcommentreminderdel" name="wcommentreminderdel" value="<?php echo $print->id; ?>">
    <?php wp_nonce_field('comment_delete_nonce') ?>
    <input type="submit" class="button-primary" name="comment_delete" value="Delete" />
    </form>
    </div>

And here's my jQuery/AJAX:

jQuery(document).ready(function($) {
	 $('#wcommentreminder-deleteform').submit(function() {

		 var data = {
			 action: 'wcommentreminder-deleteaction',
			 name: document.getElementById("wcommentreminderdel").value,
			 securitydel: document.getElementById("_wpnonce").value
		 };

		 $.post(ajaxurl, data, function(response) {
			alert('Works!');
		 });

		 return false;
	 });
});

And just to make sure you have it all, here's my "action":

add_action('wp_ajax_wcommentreminder-deleteaction','wcommentreminder_form_delete');

function wcommentreminder_form_delete() {
	global $wpdb;

	$table_name = $wpdb->prefix . "wcommentreminder";

	$id = $_POST['name'];

	if (!wp_verify_nonce($_POST['securitydel'],'comment_reminder_field_nonce') ) { wp_die('Oops, your nonce didn\'t verify. So there.'); }

	$wpdb->query("DELETE FROM $table_name WHERE id = '$id'") or wp_die(mysql_error());

	if($wpdb){
	echo "<div class='updated'>The URL was deleted! <a href='' onClick='window.location.reload()'>Add another one?</a></div>";
	} else {
	echo "Error, try again later.";
	}

	die();

}

Can anyone see whats wrong here?
Why is it, only the first "Delete" button that works???
Help!

Thank you in advance
Aris Kuckovic

Pete on "How to automatically assign a specific author to a custom post type"

0
0

How would I automatically assign a specific author to all custom posts assigned to a specific custom post type?

Any help appreciated :)

Pete

Luke Janicke on "My plugin with 'the_content' filter breaks trying to add excerpt"

0
0

This plugin breaks WordPress (blank browser window) if a post has no excerpt. Any idea why?

<?php /*

Plugin Name: Excerpt in Post
Plugin URI:  https://github.com/lukejanicke/excerpt-in-post
Description: Add post excerpts to top of post content output (inc. RSS) wrapped in <code><p class="excerpt">…</p></code>.
Version:     1.0
Author:      Luke Janicke
Author URI:  http://www.lukejanicke.com/
Licence:     GPL2+

*/

function excerpt_in_post( $content ) {

	// Add the excerpt to the top of posts (including in RSS feeds)

	$excerpt = get_the_excerpt();

	if ( $excerpt ) $content = sprintf( '<p class="excerpt">%s</p>%s', $excerpt, $content );

	return $content;

}
add_filter( "the_content", "excerpt_in_post", 20 );
add_filter( "the_content_feed", "excerpt_in_post", 20 );

?>

Bmathers on "Custom Class on anchors in menu li items"

0
0

Hi,

I have the following code

<?php
function menu_element_class($classes, $item){
    if($item->ID == 21 || $item->menu_item_parent == 21) {
        $classes[] = "menu_element";
    }
    return $classes;
}

add_filter('nav_menu_css_class' , 'menu_element_class' , 10 , 2);
?>

I found this running through some previous questions around this area. However this adds the class to the list item and not the "element" beneath it.

The real reason i want it is i would like to have some of my main navigation items pop up in a thickbox, i have the thickbox plug in and it works, i just need the class="thickbox" assigned to it.

Pete on "How to only display something if the post's gallery has more than 1 image"

0
0

I'm looking for a snippet of code (looked and googled everywhere) that will only display something/anything/html etc if the gallery attached to a post has more than 1 image.

Thanks heaps

Love Pete

Pete on "get_posts inside my loop is breaking my loop"

0
0

This piece of code is screwing up my loop on my single-CCCC.php custom post type template

<?php $posts = $posts = get_posts( array('include' => implode( ',', $_SESSION['pid'] ), 'post_type' => array('AAAA','BBBB'),'orderby' => 'rand','numberposts' => '5',) ); foreach($posts as $post) { ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>, <?php } ?>

My loop is this...
<?php if( have_posts() ) : ?><?php while( have_posts() ) : the_post(); ?>
then this
<?php the_title(); ?> which works fine
then
<?php $posts = $posts = get_posts( array('include' => implode( ',', $_SESSION['pid'] ), 'post_type' => array('AAAA','BBBB'),'orderby' => 'rand','numberposts' => '5',) ); foreach($posts as $post) { ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>, <?php } ?>
then
<?php the_title(); ?> which doesn't work
then this
<?php endwhile; else: endif; ?>

tarikaone on "Mark a widget as dirty in the customizer"

0
0

Hey there, I am building a widget that allows the user to upload/select a number of images. Due to the dynamic nature, input fields are dynamically added to the widget form. Everything works exactly how I'd like, however in the customizer I can't seem to dirty the widget telling the customizer it can be saved when an image is added or removed.

I figure the input fields I am dynamically adding to the form are missing certain event hooks that WordPress adds when the customizer is first loaded. But what I can't figure out is what hooks they are, and how to fire them.

Here is a description of the event:

1. You customize a page with dynamic sidebars.
2. Add a widget to that sidebar within the customizer.
3. Save and publish.
4. Modify the widget, this should mark the widget as dirty and enable the save/publish button again.

Curiously if I type something in the title field of the widget this event does fire, and saving works exactly as I should, so I'm certain there must be a way around this. I've done a lot of digging with no avail, so any help on this subject would be deeply appreciated.

Steve

NaamaGold on "storing one piece of data for whole post-type"

0
0

Hi

I am writing my first plugin for my site and i was wondering if you could help me to work out the best way to achieve what I need.

I want to store one date for all posts associated with a post-type in a way that I can update that date in one place and it will update on each post of that post-type.

I thought of using custom fields but then it would not update all the posts at the same time but individually.

I thought of creating a global variable that would store this information and be able to have an update button in a plugin and then on each post it would draw from that variable.

The question is, what is the correct way to create the variable so it would be available between sessions? Do I need to create a new database for this? Can I add a new field in the post-type database? Does a global variable hold its info between sessions?

Thanks so much for your help!

WebTechGlobal on "Adding Third Post Box Column: postbox-container-3"

0
0

I've implemented postboxes in CSV 2 POST but I'm not sure how to use a three column layout. Just adding the div doesn't work because obviously there needs to be a screen option for it. Which I have added to my plugin also. But despite having screen option for a 3rd column layout and the div in place it does not work.

What could I be missing?

<div id="postbox-container-3" class="postbox-container">
                        <?php
                        $this->do_text_boxes( 'normal' );
                        $this->do_meta_boxes( 'normal' );

                        $this->do_text_boxes( 'additional' );
                        $this->do_meta_boxes( 'additional' );

                        // print all submit buttons
                        $this->do_text_boxes( 'submit' );
                        ?>
                    </div>
                    <div id="postbox-container-2" class="postbox-container">
                        <?php
                        $this->do_text_boxes( 'normal' );
                        $this->do_meta_boxes( 'normal' );

                        $this->do_text_boxes( 'additional' );
                        $this->do_meta_boxes( 'additional' );

                        // print all submit buttons
                        $this->do_text_boxes( 'submit' );
                        ?>
                    </div>
                    <div id="postbox-container-1" class="postbox-container">
                    <?php
                        // print all boxes in the sidebar
                        $this->do_text_boxes( 'side' );
                        $this->do_meta_boxes( 'side' );
                    ?>
                    </div>

I have asked the same question on Stack Exchange Wordpress if your interested in covering it there also...

Junaidkbr on "Making Gallery Posts from Existing Bulk Images"

0
0

Hello guys!
I have been planning on trying something new with my upcoming picture blog. My idea is to post bulk pictures (related to my blog category) as posts (one picture each post) and then allow users to make galleries out of them.

Concept of galleries is to Make a gallery post (with my own attributes in database) and users can search and select pictures to add to their galleries and then publish the galleries.

1. Each image is treated as a separate post, so showing the images is not an issue.
2. The galleries will be posted on my blog.

Is there any plugin for this work? or if you have any better suggestion for such a plan?

Now, I can code this in my own way. But thought if I get a plugin, it'll great.

I have sketched that there'll be an extra column in Posts table which would collect the POST IDs of the posts/images a user adds to his/her gallery. Then, on request of that post, the code of single.php would just fetch the first image or attached image from each of those post IDs.

Please, make me head the right way.


Free269 on "What is the best way to improve in wordpress development"

0
0

Hi guys,

I'm new to Wordpress, working on a website for about 2 months. First built my own theme and learnt how things work from this level (file structure, basic functions, responsive mobile design, ect' ).

So I started to do things more advanced like writing a code to get random posts on the sidebar, and that too, used scripts that are already written, what help to interduce me to new functions that I didn't know of.
after trying to write stuff on wordpress, I noticed that I have a block that I really want to overcome.
I code in PHP, JS, CSS, jQuery, HMTL in a basic level, and I want to start writing plugins myself, to build over the current wordpress code in the best efficient way myself, to know how it works, and learn it in the best and fastest way.
I noticed that when I wanted to create a "load more posts" button in the end of the homepage, when I realized that I know to work in ajax and php, but just cant manage to apply it on my WP website.

So, I know that there is a lot of the documentation on the website, but everything is very unorganized. there is no specific way to learn it.
I would like to hear what you guys thing about this, and maybe tell me how you become experts with wordpress. If you have any recommendations for good books that you know will help me, or online courses..

Thank you guys.

Free269 on "Facebook share buttons"

0
0

Hi guys,

I was trying to look for a share button that shows how many people shared the post, and just cant find one.
The one with the counter that facebook is offering is a counter for the likes as far as I know.
There are some websites that have both counter for shares and likes.

I don't want to use a plugin for this.
Thanks.

razirazo on "How to prevent admins to delete certain other admin account?"

0
0

Im building website and setting up admin accounts.
The admins will change - get created, and deleted from time to time.
But my account - as site developer will always exist to provide long term support.

So I want to have these admins account:

Admin1 - Me.
Admin1 is highest admin. can create and delete all admin accounts.

Admin2 - yet another admin.
Admin3 - yet another admin.
Admin4 - yet another admin.
Admin 2,3 and 4 can create another admin, delete any other admin, except Admin1.

Is there any way to implement this?

Chris45454 on "Trying to display some html inside a wordpress template page for a specific url"

0
0

Hi guys,

Really pulling my hair out with this one. I have a wordpress blog with a plugin that uses a page on the site.

I've assigned a custom wordpress template to the page in question and would like to display some unique HTML on specific specific auto-generated child pages. These child pages aren't actually created in wordpress so I'm unable to just use wordpress conditions based on the pages attributes (ID, slug etc).

My question is, how can I use PHP to display custom HTML code based on a specific wordpress URL? I've tried some php snippets but i always get header errors.

I know my way around the Wordpress Codex stuff, but no clue about the PHP stuff.

Any help would be amazing

if (get_permalink() == "http://myurl.com/thispagethatiwant") {
    echo 'hi';
}

This looks to be the simplest way, but it echos the text across other areas like

http://myurl.com/thispagethatiwant/category1/
http://myurl.com/thispagethatiwant/category2/ etc

I want the text limited absolutely to a specific url.

johnandchandi on "Error message"

0
0

I have a customer who receives this message when trying to get on our website skinstrong.com
AVG Alert
Threat was blocked
File: skinstrong.com
Exploit Blackhat SEO (type1720)
What does this mean?

Viewing all 8245 articles
Browse latest View live




Latest Images