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

Guido on "Uninstall.php: remove custom taxonomy and term"

$
0
0

Hi,

I have this in my uninstall.php in order to delete my custom taxonomy called 'event_cat' and all terms:

// If uninstall is not called from WordPress, exit
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();

// Delete terms
$terms = get_terms( 'event_cat', array(
	'fields' => 'ids',
	'hide_empty' => false
) );
foreach ( $terms as $value ) {
	wp_delete_term( $value, 'event_cat' );
}

global $wpdb;

// Delete taxonomy
$table = $wpdb->prefix . "event_cat";
$wpdb->query( "DROP TABLE IF EXISTS $table" );

But after de-installing plugin custom taxonomy and terms are still listed in database.

Am I missing something?

Guido


Adicricket1 on "Website code issues"

$
0
0

Hi, new to this so please bear with me.

Ive currently taken over the club website and its having trouble showing content in the side bars?

I think the code may need a tweek or there is some missing?

<<!-- Return Header -->
<?php get_header(); ?>
<div class="container-fluid front-page-image">
<img src="<?php echo bloginfo('template_url'); ?>/assets/images/sewerbycc-main-arial.jpg" alt="Sewerby CC" />
</div>
<!-- Main container div START -->
<div class="container">
<!-- background-white rounded-div -->
<div class="row">
<div class="col-md-12">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<h1><?php the_title(); ?></h1>

<?php the_content(); ?>

<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>
</div>
<!-- Main container div END -->
</div>

<!-- Return Footer -->
<?php get_footer(); ?>

Any help would be appreciated.

chrisray1245 on "Google Redirect site hack."

$
0
0

I have been trying to trouble shoot this for the past week.
Notified by google that our site "may have been hacked."
When you google search our name it redirected to a VIAGRA site.
When you entered the URL manualy eveything was good
Ran wordfence and located a malware located in a comment. Cleared malware.
Ran google sitemap but now recieve 404 error
When you google search our name it now redirects to a
"The requested URL /exam-doy.php was not found on this server."

I have researched this issue on the forum and checked the mySQL for malcode and found nothing.

Any help would be greatly appreciated.

didhavn on "Strange/unwanted change of page permalink by custom meta box"

$
0
0

Hey All.

I have a really stange behaviour.
I added a custom meta box to my pages where I query the names of all "Meta Slider Slideshows" that I have added.
When I then edit a page and save it, the permalink of the page gets changed!! And it always get's changed in a way that the post-name in the permalink is replaced by the last Slideshow-title of the query.

e.g.: http://test.de/test-page get's changed to http://test.de/slideshow2 because I have two slideshows, slideshow1 and slideshow2

I have really no idea what can cause this behaviour and I am thankful for every hint or idea!!

The function in functions.php looks like that

function custom_meta_box_markup() {
	$args = array(
	  'post_type' => 'offer'
	);
	$my_query = new WP_Query($args);
	if( $my_query->have_posts() ) {
		wp_nonce_field(basename(__FILE__), "recrew-slideshow-meta-box-nonce");
// THIS IS THE PART THAT SEEMS TO BE RESPONSIBLE FOR THE BEHAVIOUR
		while ( $my_query->have_posts() ) : $my_query->the_post();
			echo '<li>';
			the_title();
			echo '</li>';
		endwhile;
// \ THIS IS THE PART THAT SEEMS TO BE RESPONSIBLE FOR THE BEHAVIOUR

	}
	wp_reset_query();
}
function add_custom_meta_box() {
	add_meta_box("recrew-slideshow-meta-box", "Recrew Slideshow", "custom_meta_box_markup", "page", "side", "high", null);
}
add_action("add_meta_boxes", "add_custom_meta_box");

I tried everything and figured out, that the while-loop is responsible for the behaviour, it doesn't matter what's inside the loop, just the loop with $my_query->the_post() is enough.

Mark O'Donnell on "Internationalization of Shared Libraries across Plugins"

$
0
0

So I have a shared library that I use across several plugins. I just wrap the functions with function_exists and deal with versioning. So far so good.

I've just changed all my plugins so the text-domain matches the plugin slug, and am now relying on the new ploygots deal for translation. BUT some of the shared libraries have user interface functions with 'wrapped' text. So how can I deal with this in 'the new world' of internationalization? What text-domain do I use so the shared libraries support translation across all plugins?

Thanks for any hints.

hamstair_toilichte on "Custom relational database in a Wordpress installation"

$
0
0

Hello all

This isn't so much a 'how to', as a request to be pointed to roads to go down to get to my destination. In brief, my query is: how can I create a relational database in the WP database, and use forms to populate and query it?

In more detail:

I'm after creating a links 'repository' for subjects (eg healthcare, languages), which would be a multi-table relational database. For instance, I developed the Global Health repository as a custom web app, using PHP, MySQL and Codeigniter at the back end. Contributors add a web resource by URL, name, keywords, topic and a few other criteria, and this data goes into a MySQL database with around ten tables, linked by foreign keys or junction tables.

What I'd like to do is write a plugin to enable such a repository in Wordpress. An example of a repo I'd like to transfer into WP is a healthcare resources database. I'd like to do this for the plugin writing exercise, to contribute a little back to the community, and to provide a simple tool for the user to create their own link repo in whatever subject they want. The end user should be able to search/browse for resources in that subject via a simple form.

So I may want to add custom tables to the WP database and relate them as I want. I'm not sure, though, about the best way of approaching this. I'm thinking that I could maybe use the excellent Advanced Custom Fields plugin with some Custom Post Types, and use the dbDelta() function to create tables on plugin activation as advised in this article.

Alternatively, perhaps I shouldn't mess about with the WP database, but rather create a separate DB and run queries on that from within WP.

There could be a number of roads to go down, but I'd prefer to avoid those that may lead to dead ends, hence this rather fluffy query to the WP community. How would youse go about doing this sort of thing? Am I duplicating the work of an existing plugin? (I did search the plugin repo under various keywords but got 00s of hits.) Am I barking up the wrong tree completely?

If this post should go into the Plugins forum, let me know and I'll repost it there.

DaRo_O on "Protect child pages with a password"

$
0
0

Hello everybody!

First of all, thank you for reading this :)

So i've got this situation in my company. We have a media page where we have all of our media ressources (Logos, graphics, and so on), the main page it's linking directly links to the child pages), it would be something like this:

--> Main media page
|----> Logo
|----> Guidelines
|----> Another thing

And like this, i've reached like 40 childs of the main media page.

The thing is, i need all those childs to be password protected, and i don't know how to manage it.

How could i do to make those child pages inherit the parent password, or something like this? i could password protect each of them manually, but this would be slow and not really usefull when in the future we add more child pages...

So, any of you have a idea? I'm already looking for something for the las 3 days...

Thank you everybody if you readed til here!

Cheers,
Daniel

shadiadi on "Remote check to see if user exists?"

$
0
0

Hi I am using Jquery to validate a form and I need to be able to check to see if the user exists by doing a callback to a custom php file check-user.php
I have included includes/user.php but I seem to be missing something.
I have searched for a while and come up with nothing what else do I need to include before includes/user.php to make wordpress work with this?

<?php
include("config.php");
include( $path . 'wp-admin/includes/user.php' );
$username = $_POST['user_login'];
function username_exists( $username ) {
	if ( $user = get_user_by( 'login', $username ) ) {
		return $user->ID;
	}
	return false;
}
$ckuser  = username_exists( $username );
echo $ckuser;
?>

bmmtstb on "Show sth on the Sidebar and easy deactivate it"

$
0
0

Hello,
i've used PHP inside the Sidebar to show a Message.

<?php $HKS_geschlossen = TRUE; ?>
<?php if ( $HKS_geschlossen): ?>
TEXT
<?php endif ;?>

My problem now is, that I have some more People using that Site, who have to change the Value of $HKS_geschlossen. Is there a Way to create sth like a Checkbox in the Admin-Bar where people with rights can change the Value? Thats what I thought is easy to use for "non-coders". If that doesn't work, does sb. know another way to simply change a Value to display/not display a part in the sidebar?

Site is: blog.schwimm-club.de

Martin

karpok on "Multiple domains, Same Content, Single Database, How?"

$
0
0

Hello Everyody,

I am using latest version of Wordpress 4.4.2.

I want to use same content in all my sites (multiple domains).

Different theme, site name, logo in each site.

With the search, i found by using different "options" table for each site, it is possible.

I duplicated "options" table with different name but I didn't found the solution to where and how I assign the new name in wordpress for options table.

As I am not the coder/developer, requesting for your help.

Thank you in advance.

Scott Botkins on "Display menu order number of a child category post."

$
0
0

How can I display the menu order number of a post inside of a child category? I already know how to display the parent category number, but I'm looking to display the post number from a child. For example overall Post A may be listed 8th on the parent category, but it's 1st on the child category inside that parent category so I'm looking to show #1 on the page.

Thanks,
Scott

slemmo on "Sidebar / -URL filter for table"

$
0
0

Hi everyone,

is there an easy way to add this feature to my wordpress site:

I have a big data table on my site, like a product comparison.

Now I want to create a filter form to use in the sidebar that can be placed on any subsite. The user can use dropdown boxes and sliders to adjust some filter options (price range, manufacturer, ...) and after a click on a button the user will be directed to the site that contains the table. Now not all elements of the table should be shown, instead the different columns are filtered by the arguments that are passed through the site by the sidebarfilter.

Anyone has an idea how to achieve this?

Regards

Hamlet_PL on "My first shorecode"

$
0
0

Welcome,
I try add my own shortcod to function.php in Hueman theme. Function doesn't show any error but I no see any <a href="...">. Below i paste my code. Where I make a error?

// ShowPrivateFile
function ShowPrivateFile() {
	ob_start();
	$output='';
	if ( is_page( 'login' ) ) {
		$output = 'Pliki dostępne tylko po zalogowaniu:'.
                '<a href="aaa.pl">abcd</a></br>'.
		'<a href="aaa.pl">Faktura Klamki.JPG</a></br>'.
		'<a href="aaa.pl">Faktura Wkladki Klucze.JPG</a></br>';
	}
	return $output;
}
add_shortcode("pokaz_prywatne_pliki", "ShowPrivateFile");

regards

dbarkley on "Restricting administrative access to website"

$
0
0

How do I restrict administrative access to my website to just myself? I have concerns someone with whom I gave access may attempt to harm the website.

saintandrews on "Noindex individual posts by category, then hide category"

$
0
0

There have been references to pieces of what I want to do in years past, but nothing current I've been able to find.

What I'd like to do is:

A. Noindex all individual posts assigned to a particular category created for that purpose; then

B. Hide that category reference from public view (or vice versa).

If I can't hide it I can always make the category reference obscure and meaningless such as simply a letter or a numeral, but from what I've seen in past years I should be able to hide/exclude a category from public view.

I'd like to be able to add these code snippets to my child theme header or functions files if possible.

No, I'm not talking about just noindexing the category taxonomy itself; I already do that. I want instead to use a category as an administrative tool to be able to steer search engines to index/noindex posts depending on whether I have assigned them to my noindex category or not while using my admin category listings to explicitly tell me which ones I've noindexed.

Hopefully this isn't nearly as complicated as I've had to make it sound to explain it.

Any code snippet help greatly appreaciated.


tobbger on "Make [audio]-player play next song"

$
0
0

I have a music blog where every post contains a link to a mp3 with an [audio]-tag surrounding them. Therefore, every post only consists of an audio player. I would like the next post/song to play when the previous post/song has ended, like if every post in the blog feed is a song in a playlist.

Is it possible to make this playlist-like connection between separate audio-tags?

vincent06 on "Help with drag and drop tasks"

$
0
0

Hi, I've integrated your amazing plugin in my WordPress page.
So I have created and loaded my custom css that fix some positioning problems in my page layout.

This is my custom css that's fix my layout issues:

.h5p-drag-droppable-words{width: 80%;}

.h5p-drag-draggables-container{
    width: 20%;
	position: absolute !important;
	top: 0;
	right: 0;

}
.h5p-drag-text .h5p-drag-draggable{
	display: block !important;
}

.h5p-drag-text .h5p-drag-dropzone.h5p-drag-correct-feedback{
	padding: 0.1em 1.65em 0.1em 0 !important;
}

.h5p-drag-draggable-wrong{
	padding: 0.1em 1.65em 0.1em 0 !important;
}
div.h5p-drag-dropzone.ui-droppable{
	padding: 0 !important;
}

.h5p-drag-text .h5p-drag-dropped{ margin: -3px 0 0 0 !important;}

If You do the task without scrolling the page there is no problems.

The problems come when you scroll the page down: in this case, when I select the draggable element, this looks far from mouse cursor. When release the mouse at any point, the draggable element moves to the top of the list but detached, and sometimes disappears upwards.

I believe it is necessary to modify this method and I tried but without success:

/**
   * Reverts the draggable to its' provided container.
   * @public
   * @params {jQuery} $container The parent which the draggable will revert to.
   */
  Draggable.prototype.revertDraggableTo = function ($container) {
    // get the relative distance between draggable and container.
    var offLeft = this.$draggable.offset().left - $container.offset().left;
    var offTop = this.$draggable.offset().top - $container.offset().top;

    // Prepend draggable to new container, but keep the offset,
    // then animate to new container's top:0, left:0
    this.$draggable.detach()
      .prependTo($container)
      .css({left: offLeft, top: offTop})
      .animate({left: 0, top: 0});
  };

In this scree you'll see the result
The cursor is at the bottom of draggable element.

In this screen draggable list problems after mouse release

It's only positioning problem. I think that it's not update the y position.

Help me, thank you very very much!!!

Code Tides on "Capturing Domain name whose install my plugin"

$
0
0

Hi, i have a free wordpress plugin hosted on wordpress.org, in that plugin i have done the code where it is capturing the domain name of plugin installed,so i know who is installing my plugin so i can improve it more or make plugins according to the needs.

My question is that, is it legal or not? will i remove my plugin from wordpress.org or stay hosted on wordpress.org?

Any suggestion or experienced programmer comments highly appreciated.

alireza1375 on "Problem to display PPC advertising"

$
0
0

I use this code for "PPC" advertising:

<script type="text/javascript">
;!( function( w, d ) {
'use strict';
var ad = { user: "11111", width: 120, height: 240, id: 'anetwork-' + ~~( Math.random() * 999999  ) },
h = d.head || d.getElementsByTagName( 'head' )[ 0 ],
s = location.protocol + '//static-cdn.anetwork.ir/aw/aw.js';
if ( typeof w.anetworkParams != 'object' )
w.anetworkParams = {};
d.write( '<div id="' + ad.id + '" style="display: inline-block"></div>' );
w.anetworkParams[ ad.id ] = ad;
d.write( '<script type="text/javascript" src="' + s + '" async></scri' + 'pt>' );
})( this, document );</script>

But I have one problem. If I insert code in to the wordpress widget doesn't work and if I insert in index.php (or page.php , single.php ,...) works!!
note : error in inspect element >> console (When I insert code in wordpress widget)

Uncaught SyntaxError: Unexpected token ILLEGAL : "mysite.com/:253
Failed to load resource: the server responded with a status of 404 (Not Found) : http://mysite.com/'%20+%20s%20+%20'

line 253 :
d.write( '</script><script type="text/javascript" src="' + s + '" async>' );
What is the problem?

tileadmin on "change custom fields into"

$
0
0

I'm trying to change the output to my filter which come from the custom fields. I'm trying to get the custom fields to be output into <select> and each custom field into an <option>.

My current code is outputting my custom fields as a dropdown but in my filter, you can choose as many options as you want and they are save for the query as tags.

Here is the code:

if (isset($directory_id) && $directory_id <> '') {
                        $custom_fields = '';
                        $cs_dcpt_custom_fields = get_post_meta($directory_id, "cs_directory_custom_fields", true);
                        if ($cs_dcpt_custom_fields <> "") {
                            echo '<li class="advance-search-custom-fields-sidebar">';
                            echo '<ul class="dr_userinfo">';
                            $cs_customfields_object = new SimpleXMLElement($cs_dcpt_custom_fields);
                            if (isset($cs_customfields_object->custom_fields_elements) && $cs_customfields_object->custom_fields_elements == '1') {
                                if (count($cs_customfields_object) > 1) {
                                    global $cs_node;
                                    foreach ($cs_customfields_object->children() as $cs_node) {
                                        if (isset($cs_node->cs_customfield_enable_search) && $cs_node->cs_customfield_enable_search == 'yes') {
                                            $custom_fields .= cs_custom_search_fields_render();
                                        }
                                    }
                                }
                            }
                            echo balanceTags($custom_fields, false);
                            echo '</ul>';
                            echo '</li>';
                        }
                    } else {
                        echo '<li class="advance-search-custom-fields-sidebar" style="display:none">';
                    }
Viewing all 8245 articles
Browse latest View live




Latest Images