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

Mehedi on "Remove numbers from permalink?"

$
0
0

Hi,

I'm currently working with Facebook's Graph API and have noticed that the API returns an error if there is a number (1,3,5, etc.) on the permalink a.k.a URL. I tried to find a way to remove the numbers from the permalink with a function but couldn't do so.

Is there any function that'd remove the numbers from a permalink?

Please help.

Thanks!


sescpapa on "distinguishing category name from category link"

$
0
0

Hi there.
First, take a look at the template I am converting to a wp-theme.
Notice that welcoming box, consisting of a title, a text, and a link.
I have replaced that part with the following code:

<div class="inner">
<header>
<h2><?php bloginfo('name'); ?></h2>
</header>
<?php
$args = array( 'posts_per_page' => 1, 'orderby' => 'rand' );
$rand_posts = get_posts( $args );
foreach ( $rand_posts as $post ) :
setup_postdata( $post ); ?>
<?php the_content(); ?>
<footer>
<ul class="buttons vertical">
<li class="button fit scrolly">
<?php the_category(); ?>
</li>
</ul>
</footer>
<?php endforeach;
wp_reset_postdata(); ?>
</div>

Basically what this does is to display my site's title on top, followed by the content of a random post, followed by a link to the category of that post.
That third and final element is what troubles me.
I would like to display only the name of the category, plus have it obeying to the appropriate css, while having the whole "small kinda box within the big box" (not just the text, that is, but the area around it as well) reacting to the category link.
Any ideas on how that would be possible?
Thanks in advance.

gusswib on "Order post by the number of category they have"

$
0
0

I have question below

Example :
Post A -> have 2 category Land , Free
Post B -> have 3 category Land, Free, Mountain
Post C -> have 1 category Land
Post D -> have 4 category Free, Beach, Cheap, Beautiful

I want to display the post like this (order by the category the post have)

1. Post C
2. Post A
3. Post B
4. Post D

Could i do like above? need your suggestion

Thanks

noobhome on "How to order a widget to ignore a function of functions.php"

$
0
0

Hi, I'm using this function that modifies the number of posts showed only in homepage, without affecting other categories.

/**
 * Fixing the Number of Post
 * Used in Homepage
 */
function simplecatch_home_custom_query( $query ) {

	if (  is_home() )
		$query->query_vars['posts_per_page'] = 5; // Change 5 to the number of posts you would like to show

	return $query; // Return our modified query variables
}
add_filter( 'pre_get_posts', 'simplecatch_home_custom_query' ); // Hook our custom function onto the request filter

This works perfect, but my problem is that a text widget in my home page is also using the posts_per_page argument, so that full widget gets multiplied by 5 (the new post_per_page that I am forcing with this function).

This is my text widget code (it's a box widget that works as a "RANDOM POST" button):

<?php
$args=array(
  'orderby' => 'rand',
  'cat' => '14',
  'post_type' => 'page',
  'post_status' => 'publish',
  'posts_per_page' => 1,
  'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
  echo '';
  while ($my_query->have_posts()) : $my_query->the_post(); ?>

<div style="width: 272px; padding: 5px; border: 4px solid gray; margin: 0; text-align: center; background-color: rgb(183, 222, 253); "><h4><font-size=6><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">Cançó aleatòria</a></font><h4></div>

    <?php
  endwhile;
}
wp_reset_query();  // Restore global post data stomped by the_post().
?>

So, what I think I need is something that makes that this widget on my homepage ignores this function, so it preserves his 'posts_per_page' => 1.

I would really apreciate your help, thank you very much in advanced.

PS: sorry for my English.

lastnoob on "Way to find out the name of a file in /wp-content/uploads"

$
0
0

Is possible to find out somehow check the content of the /wp-content/uploads folder? I dont neccessarily need to open the file itself.

zubaidabeauty on "zubaidabeauty"

$
0
0

There is an string (loan qualification calculator) that is put is my top navigation menu at http://zubaidabeauty.com, now i want to delete that. how can i remove that link from my top navigation.

Yudhistira Mauris on "Save array into WordPress options"

$
0
0

Hello,

I am having a problem when saving an array into WordPress options. Basically, I have two different settings pages that will be saved into one database row as an array. These two different pages is registered using one register_setting() and two separate add_settings_section().

In my sanitizing function, all data are saved correctly except one select element which accept multiple selections. It will be saved as multidimensional array in the one database row. Here is my code to save that array.

public function sanitize_options( $input ) {

    $options = get_option( 'prfx_options' );

    if ( isset( $input['post_types'] ) && count( $input['post_types'] ) > 0 ) {
        $input['post_types'] = array_map( 'esc_attr', $input['post_types'] );
    } elseif {
        $input['post_types'] = array();
    }

    if ( is_array( $wpsdcp_options ) ) {
        return array_merge( $options, apply_filters( 'prfx_options_sanitization', $input ) );
	} else {
		return apply_filters( 'prfx_options_sanitization', $input );
	}
}

It should accept 0 or more selections. It works fine when there's at least one selection that is selected. But when there's nothing that is selected, it won't save it. I've tried count() and empty() but neither would work. Is there something wrong with my code?

Thank you in advance!
Mauris

juliedc on "wp_dropdown_categories in a template file"

$
0
0

Hello, I have been researching and trying things for days and the closest thing to a concensus I get as far as how to do this is to use this code. I've created a dropdown list of categories with links to those category pages. The drop down appears (on this page: ) but it should be excluding the categories 0,9,12,43. They still show. Interestingly, I can sort the categories in ascending or descending order and that responds but no the category exclusion.

I also would like to show Select Category as a non-linked label at the top of the list and am not sure how to do this. Any help would be much appreciated! My eyeballs are fried!

<?php wp_dropdown_categories
($args = array (
	'show_option_all'    => '',
	'show_option_none'   => '',
	'orderby'            => 'ID',
	'order'              => 'ASC',
	'show_count'         => 0,
	'hide_empty'         => 1,
	'child_of'           => 0,
	'exclude'            => '0,9,12,43',
	'echo'               => 1,
	'selected'           => 0,
	'hierarchical'       => 0,
	'name'               => 'cat',
	'id'                 => '',
	'class'              => 'postform',
	'depth'              => 0,
	'tab_index'          => 0,
	'taxonomy'           => 'category',
	'hide_if_empty'      => '',)
); ?>

adnanasif02 on "unknown link appear in my wordpress site.. Help"

$
0
0

Hi WordPress experts
I have an issue with my wordpress site.
An unknown link appear in my website , i don't know what's happened.
I think that was related with a bad plugin , i disable all my plugins but link still there.
I also change my wordpress theme. but link still there..
here is my website
http://buylxwprot.com/
link is below the header with the name of.. "direct lender installment loans for bad credit"
Please help..
thanks
waiting

ngvadmin on "Content is suspect" /wp-content/plugins/wordfence/lib/wfLog.php"

$
0
0

Dear all

I received a message from my ISP that The following content is suspect:
./wp-content/plugins/wordfence/lib/wfLog.php. I have done a Wordfence scan of my site and it indicated that there is no malware. What can I do to verify the content of the file?

Background. It seems that I am frequently get hacked for mailbot malware. The recent incident was in the following file:
wp-content/cache/db/000000/all/ee5/login.php: (Php.Malware.Mailbot-1 FOUND.

I need assistance how to identify the suspect code in the Wordfence file and how to stop the Php.Malware.Mailbot hacks. All my plugins, themes translations and WP version are up to date.

Please have patience as this is my first post. Feel free to ask for more information.

Regards

Thank you

birdshost on "Your plugin hosting request has been approved."

$
0
0

hi i have also same massage but no files showing what can i do?? this approved almost 4 days but still no files
Your plugin hosting request has been approved.

Within one hour, you will have access to your SVN repository at

http://plugins.svn.wordpress.org/ask-question-by-birds-host/

with your WordPress.org username and password (the same one you use on the forums).

Here's some handy links to help you get started.

Using Subversion with the WordPress Plugins Directory
https://wordpress.org/plugins/about/svn/

FAQ about the WordPress Plugins Directory
https://wordpress.org/plugins/about/faq/

WordPress Plugins Directory readme.txt standard
https://wordpress.org/plugins/about/readme.txt

readme.txt validator:
https://wordpress.org/plugins/about/validator/

Enjoy!

silversteel on "plugin svn issue -> redirecting to facebook?"

$
0
0

Im trying to check out my plugin from SVN. This has worked on other machine just fine.

svn co http://plugins.svn.wordpress.org/my-plugin .
Redirecting to URL 'http://plugins.facebook.com/my-plugin':
Redirecting to URL 'http://www.facebook.com/my-plugin':
svn: E175011: Repository moved permanently to 'https://www.facebook.com/my-plugin'; please relocate

but then when im trying to reach the facebok my plugin url it doesnt work as well.

can anyone help?

dave_ac on "Navigation external site - can of worms"

$
0
0

Hi,

I have inherited a project that is a can of worms (There is not the time to rewrite poorly written scripts + I am not slick with WP )

The question is there are two sites wordpress.business.com and micro.business.com.

wordpress.business is working fine and so is micro.business. Wordpress is using a child of elegant themes Divi design

What options or examples are there for querying the wordpress database / site and returning the current main and footer menus and header / banner text?

I have spent today googling and writing a class that will return blocks of code, but it is not a satisfactory method?

Any thoughts or hints?
Many thanks

pervbox on "Redirect unsucessful searches to specific URLs"

$
0
0

Hi,

Not sure if anyone can help or not but here's what I want to do...

When a user searches for something using my wordpress search box and doesn't get a match then I want to redirect that user to an URL but which URL they get redirected to depends on what they were searching for.

So for example I have redirect URL A.
Redirect URL A takes a user to a website about cats.
When a user searches for anything with the word cat or any other pre-defined search term and no results are found then redirect that user to URL A.

Ideally I'd like to do it something like this:

Redirect URL A:
Keyword or Phrase 1 (required)
Keyword 2 or Phrase (optional)
" repeat "

Redirect URL B
Keyword 1 or Phrase (required)
Keyword 2 or Phrase (optional)
" repeat "

Any ideas?

Please try to be specific and simplistic in your terminology too as I'm not too familiar with coding or wordpress core. I can do simple programming things but nothing mega advance.

Thanks in advance!

Agence Myso on "`get_posts` by months?"

$
0
0

Hi everyone,

I'm getting mad... I am using wp_get_archives_cpt to display a list of custom post types by month. I would like the corresponding posts to show on the same archive page.
But I can't figure out how to display the posts corresponding to each month... I don't see any way to query posts by month ??!
Please help me !
Thank you all.


Bolder Elements on "Private Plugin Auto Updates"

$
0
0

I am so close to finishing up the ability to auto-update my personal (non-repository) plugins, but getting it to work on a network install is a nightmare. I have no other way to include the files for the update than from my plugin's primary file, but this file does not load whatsoever from the network admin because it is not network enabled, only individually per site. This means that the information is never properly loaded into the network plugins page, and if I visit this page, it throws a wp_error and ditches the upgrade information.

Is this an impossible task?

drudarby on "Returning array"

$
0
0

I've been banging my head on the desk for a while over this. Seems like it should be pretty simple but... not working. Trying to simply return an array from a function.

I have a grid showing database results. If any are in error, there should be notifications as such above the grid.
-I call a function which checks the results for errors, and counts them. Within this function, another function is called to display the notification indicating the quantity of errors. This works properly.

-These notification also provides a link to view the database record in question - primary key 'id' is returned in an array from the function. However, the array that I am returning that should contain the 'id' of the erroneous record comes out of the function empty. If I var_dump within the function, the array contains the records I would expect it to.

The code for the main page flows like this (code is abbreviated):

include 'header.php'
include 'error_check.php' (file containing the error check function)
include 'notices.php' (file containing the function to display notices)
check_for_errors($qdate, $salesman_id);
if($_REQUEST['view'] = 'nomatch' { include 'nomatch_grid.php' }
if($_REQUEST['view'] = 'unknown' { include 'unknown_grid.php' }
if(!$_REQUEST['view'] { include 'main_grid.php' }

Here is the code for the check_for_errors() function:

function check_for_errors($cfe_date, $salesman_id) {
	global $wpdb;

	$d_year = date('Y', $cfe_date);
	$d_month = date('m', $cfe_date);

	$spiffs = $wpdb->get_results("SELECT * FROM spiff_records LEFT JOIN spiff_items ON spiff_records.item = spiff_items.item_number WHERE YEAR(inv_date) = $d_year AND MONTH(inv_date) = $d_month AND salesman_id = $salesman_id ORDER BY inv_date ASC");

	/**
	* RUN THROUGH ALL SPIFFS RETURNED IN MAIN QUERY
	* ASSIGN COUNT OF HOW MANY RECORDS DONT MATCH AN ITEM
	* CREATE ARRAY CONTAINING <code>SPIFF_ID</code> WITH ITEMS THAT DON'T MATCH
	**/
	$nomatchct = 0;
	$nmarray = array();
	foreach($spiffs as $nomatch) {
		if(!$nomatch->item_number && $nomatch->unknown != 1) {
			$nomatchct = $nomatchct + 1;
			$nmarray[] = (string)$nomatch->spiff_id;
		}
	}

	/**
	* RUN THROUGH ALL SPIFFS RETURNED IN MAIN QUERY
	* ASSIGN COUNT OF OUT HOW MANY ARE MARKED AS UNKNOWN BY ADMIN
	* CREATE ARRAY CONTAINING <code>SPIFF_ID</code> WITH RECORDS MARKED AS UNKNOWN
	**/
	$unknownct = 0;
	foreach($spiffs as $unknown) {
		if($unknown->unknown == 1) {
			$unknownct = $unknownct + 1;
			$ukarray[] = (string)$unknown->spiff_id;
		}
	}

	display_notices($unknownct, $nomatchct);
	return $ukarray;
}

Finally, here is the link for the display_notices() function:

function display_notices($unknownct, $nomatchct) {
	if($unknownct > 0) {
		echo '<div class="notice red">';
			echo '<p><strong>NOTICE:</strong> You have ' .$unknownct. ' records with unknown item numbers.  <a href="/view/?view=unknown">Click here to review these entries.</a></p>';
		echo '</div>';
	}

	if($nomatchct > 0) {
		echo '<div class="notice green">';
			echo '<p><strong>NOTICE:</strong> You have ' .$nomatchct. ' records waiting to be reviewed.  <a href="/view/?view=nomatch">Click here to review these entries.</a></p>';
		echo '</div>';
	}
}

Since I am using includes, the check_for_errors() is run no matter which grid we are looking at, so if I return the $ukarray or the $nmarray, I should be able to use those arrays in order to display the records who's ID is in that array. Or So I thought.

If anyone has time to check this out and let me know what they think I'd greatly appreciate it!!

Ziggery on "Pulling Data and Putting It In Tables"

$
0
0

Morning all,

This is my first post into WP and I just need some help please.
I am very new to WP and and the structure of its database.

I have a table in the DB called WP_8_ANS , in the table are the answers to 4 questions. The answers are in field "QNS_1" and numbered 11,12,13 & 14, the value of each answer is in a field called "ANS_VAL"

What I would like to do is pull that data and display it on a WP webpage into columns. So column 1 would have ID11's, Column 2 would have ID12 and so on.

One other thing I would like is the header column to be labeled 11,12,13 & 14.

There are going to be approx 900 answers. I know I have to figure out a way to paginate it but I can get to that another time

Thanks all

~Z

kpalmer@rochester.rr.com on "Attacks from China"

$
0
0

A web site that I manage has dozens of attempts to enter enter the site as administrator. We have been lucky that nobody has succeeded in hacking the site yet because of Word Fence blocking the entrance. I change the passwords every week or so to long passwords that contain 20 characters. Do others have this problem? It is a small site at http://www.ovationrealtygroup.com

r0xta on "Using ORDER BY-query with generic results"

$
0
0

Hi *,

I am trying to sort a table from my wordpress plugin with this query:

global $wpdb;
$table_name = $wpdb->prefix . 'mytablename';
$myentries = $wpdb->get_results("SELECT * FROM $table_name ORDER BY date DESC");

But the "ORDER BY" seems to have no effect. It is still sorted last in first out (by id). Is there something that I'm overlooking in the documentation ?? -> http://codex.wordpress.org/Class_Reference/wpdb#SELECT_Generic_Results

Viewing all 8245 articles
Browse latest View live




Latest Images