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

prokops on "Post css colors based on category?"

0
0

Hi!

I am looking for having posts in a post grid on my page behave differently by having a category based css selector assigned. Ie. if a post belongs to the "sports" category, then I wish that post thumbnail have a "category-sports" css selector.

I see that this has been presented and solved many times before, I just can't make any of that work. I have tried Lorelle's solution and related plugin. This does not help me with assigning category css to post grid om my main static page as I am looking for.

The remaining posts on this forum are either outdated or I do not know what to do with them. I understand that the hack I need has a function.php component, a php content component and a css component.

Can someone help me with a comprehensible solution?

I am new to wordpress and apologize for disregarding conventions here, I aspire to become a resource for the wordpress community once I get a grasp on things.

Thanks in advance!


mae48 on "Homepage search linked to other search page"

0
0

Hi, I'm developing a site where I can connect my homepage search engine to my other search engine page(for the result of products)..How can I do that?

Marcelo Sampaio on "how do I show parents and child categories"

0
0
how do I show parents and child categories?
I made the following code:

<ul>
    <?php
    $taxonomy = 'categoria-noticia';
    $args = array(
        'number' => '0'
    );
    $myItens = get_terms($taxonomy, $args);
    ?>
    <?php foreach ($myItens as $myItem): ?>

        <li>
            <a href="<?php echo get_term_link($myItem->slug, $taxonomy); ?>" title="<?php echo $myItem->name; ?>">
                <?php echo $myItem->name; ?>
            </a>
        </li>

    <?php endforeach; ?>
</ul>

it displays the categories in the following format

<ul>
    <li>father 1</li>
    <li>father 2</li>
    <li>father 3</li>
    <li>father's son 1</li>
</ul>

the format I want is the following

<ul>
    <li>father 1
        <ul>
            <li>father's son 1</li>
        </ul>
    </li>
    <li>father 2</li>
    <li>father 3</li>
</ul>

Where do I modify the code to do this hierarchy.

I thank you all for your help.

LogixTree on "How to allow commas in taxonomies under admin panel ?"

0
0

Hello guys,

We starting out working on a project. We created custom taxonomies (ie Authors) for posts.Now the issue is the standard format for the author's value is like 'Williamson, K.'. There is a comma inside the author name. But the WordPress keep on separating them into different units.

Is there any way to allow commas in taxonomies under admin panel ?
(Note: Yes, I tried to create the author with commas in Author taxonomies page. But i can't assign it to any post.)

Thanks

nik10.mah on "Checkbox group on attachments page"

0
0

I am trying to add check boxes on media page depending upon no of roles in the system and I have been able to do that like this.

function add_custom_attachment_fields($form_fields, $post){

	    $wp_roles = new WP_Roles();
	    $roles = $wp_roles->get_names();
        $role_checkboxes = "";
       foreach ($roles as $role_value => $role_name) {
 	     $role_checkboxes .=	"<br/><input type='checkbox' value='$role_value' name='attachments[{$post->ID}][secured][]'  id='attachments[{$post->ID}][$role_value]' /> <label for='attachments[{$post->ID}][$role_value]'> $role_name </label>";
        }
		$form_fields["secured"]["label"] = __("Downloadable for");
		$form_fields["secured"]["input"] = "html";
		$form_fields["secured"]["html"] = $role_checkboxes;
	   return $form_fields;
    }
    add_filter('attachment_fields_to_edit', 'add_custom_attachment_fields', null, 2);

And this is how I am trying to save the checkboxes values.

function save_custom_attachment_fields($post, $attachment){
        if( isset($attachment['secured']) ){
            update_post_meta($post['ID'], '_secured', $attachment['secured']);
        }else{
    	    delete_post_meta($post['ID'], '_secured');
        }
       return $post;
    }
    add_filter('attachment_fields_to_save','save_custom_attachment_fields', null, 2);

What I expect is an array of values which have been checked but I am only getting one value in the array which is last checked value in the sequence.
How can get the array of all checked values instead of just latest checked value.

Thanks.

nabtron on "Custom post type shows all if no post from user"

0
0

Hi.

I'm trying to achieve this (without using any plugins):

  • Adding custom post type
  • Allow subscribers to create, edit, view their own posts "only" in wp-admin
  • I'm using this code:

register_post_type('my_custom_post', array(
            'labels'        => array(
                'name'          => __('custom name', 'my_custom_post'),
                'singular_name' => __('custom name', 'my_custom_post'),
            ),
            'public'        => true,
            'has_archive'   => true,
            'show_ui'       => true,
            'capabilities' => array(
              'edit_post'          => 'read',
              'read_post'          => 'read',
              'delete_post'        => 'read',
              'edit_posts'         => 'read',
              'edit_others_posts'  => 'manage_options',
              'publish_posts'      => 'read',
              'read_private_posts' => 'manage_options',
              'create_posts'       => 'read',
            )
        ));

Everything goes fine, however there is one issue.

The user sees only his posts, when he have created at least one post.

However, if he haven't made any post yet, he sees all posts from other users too.

Can anyone direct me what I'm missing please? Or is it a bug in WordPress core?

parakeet on "Only allow editing of user taxonomies?"

0
0

I want to give a user access to perform only a limited activity in my backend...

That is, to update fellow users' categories and tags.

I don't yet have a users taxonomy set up, but intend to.

When I do, how could I give a user the right to go in to a user profile, and update only the categories and tags applied to that use?

harshclimate on "Displaying Taxonomy and Descriptions"

0
0

Hi All,

I'm trying to get taxonomies and their descriptions echo'd on a template page that I added. I've scoured wordpress for this but for the life of me, I can't find anything on it. I know it's out there but I need help.

My goal is to have a page called "Categories" which is linked on my main menu. Once clicked, it'll take you to a page that lists every single category that has been used on my website (including their descriptions). They should link to their respective archive.

I would surely appreciate any help anyone could offer.


jbreeland on "New coder troubleshooting help"

0
0

Hello all. I know enough to be dangerous and I'm taking on something above my head, but that's how I learn best. I'm not necessarily looking for the answers, just guidance on where to look or whats a best practice to find the errors (I'm on day 3).

Our site has two problems that I can't figure out. http://208.43.236.10/~scaradmin1/wordpress/

Problem #1
The four boxes below the videos are colored in the them, but when we activate Masterslider, they change to all white. I believe Masterslider has a class with the same name and since it comes later, it takes priority for how it works (just guessing here). The bizarre thing is the colors show up on mobile.

Problem #2
I created this problem trying to solve problem #1. The main menu should drop down when hovered over the selection. This doesn't work no matter what plugins I disable.

Many thanks in advance for any help you may have.

buddika987 on "Print All post 2 Columns in wordpress"

0
0

I Used Bellow code for print month and all post title. I use this code and I get the out put I need yet I need the month on the left hand side. When the monthly post number is even the month stay to left, however if the number is an odd number the month goes to a wrong place.

<?php
$blogtime = date('Y');
$prev_limit_year = $blogtime - 1;
$prev_month = '';
$prev_year = '';

$args = array('post_type' => 'post','post_status' => 'publish','posts_per_page'=>-1);
$postsbymonth = new WP_Query($args);

while($postsbymonth->have_posts()) { $postsbymonth->the_post();

if(get_the_time('F') != $prev_month || get_the_time('Y') != $prev_year && get_the_time('Y') == $prev_limit_year) {?>

<div class="col-sm-12">
<h2><?php echo get_the_time('F, Y')?></h2>
</div>
<?php } ?>

<div class="col-sm-6">
<h3>"><?php the_title(); ?></h3>
</div>

<?php
$prev_month = get_the_time('F');
$prev_year = get_the_time('Y');
} ?>

https://wordpress.org/plugins/wordpress/

zendyteam on "Someone manage to create 5 Administrator accounts"

0
0

I just check my email, and my website send me notification a user account was created, have 5 emails .. and I know I have disabled to register users.

Emails they used to create account was:
1) oxqudshaie@[removed]
2) lmiexknviv@[removed]
3) rrdvfiwljf@[removed]
4) pvqnnewhll@[removed]
5) xykzmmgpfo@[removed]

I make update to last version 4.5.1 but how they manage to create access?

All accounts was created at Apr 26 at 4:19 am. All 5 accounts.

I request some support directly from Official WordPress Support and not random user, so I give them access to website to have a look.

I will give as well via Skype or Team Viewer (via Meeting). But I will prefer to be via Skype.

bmontgomery on "How to sort the results of custom WP_Query by category name"

0
0

Hello,

I wrote a plugin that uses WP_Query to display some posts, depending of the users choices. The query is made on taxonomies.
It's working pretty well, but the only thing I'm not able to achieve is the order of the results.
I'd like to sort the results by catagory names, but it's not working...
In the args, here's what I wrote:

'orderby' => 'category',
'order' => 'asc',

I don't understand what's wrong. Could anybody help me?
Thanks

fraktale on "migrate custom fields to excerpts (phpmyadmin or functions.php)"

0
0

Hi

I have 500 posts and i would like to migrate custom field element to excerpt. Is anybody know if it's possible easily ? may be by using phpmyadmin or a functions.php trick ?

thanks for your answer

fraktale

jockebq on "Hide header/logo, top navigation bar and footer?"

0
0

Hi,

I found a plugin that lets me hide the navigation and the top navigation when a user is logged in.
This works well. But I also want to hide the top navigation bar (not the admin one). And the header (logo and all).
And also the footer.

I want it to only show the content of the site when a specific user role is logged in (in this case Subscriber).

How do I do this?

coumineol on "Payment gateway development"

0
0

Hi, I'm developing a payment gateway for Woocommerce (by extending the WC_Payment_Gateway class). I should send the order data to a third party and get confirmation code (and other info) from them. The problem is that they don't return this confirmation code as a direct response to my POST request. Instead, they process it, and send a POST request to a URL that I can specify. Because of this, I can't use the wp_remote_post.

I want the customer to stay at the checkout page if it's not approved, and process the order and go to the thank you page if it is. My question is:

How can I implement this, and if possible, ensure that the costumer stays on my page?

Thanks.


sharkonda on "Imagemapster Jquery Plugin"

0
0

Hi, I'm using Imagemapster for adding a hover effect to my header image. I successfully load the imagemapster.js, my script (also .js in theme folder), but nothing seems to happen. I've already digged around on Google for answers, and I've found nothing that works.
Here's the code:
jQuery(document).ready(function($) {
$('#navigacija'}.mapster({
singleSelect : true,
clickNavigate : true,
mapKey: 'color',
fill : true,
altImage : 'wp-includes/images/files/posaoodkuce-nav-image-hover.gif',
fillOpacity : 1,
});
});`

here's the site: http://posaoodkuce.com/

midget8 on "[Permalinks] How to change Permalink in static Page Wordpress"

0
0

Hello

I have a question , have for exampel domain like this:

example.com . When i site by this domain , domain extend to something like this : example.com/home-page . How to make permalink example.com for Main Static Page in wordpress , rest pages are defulat /%postname%/.

I will be very thankful , for you feedback and answers.

Thanks!

kjgbriggs on "Storing Unique Data on Database Table"

0
0

I am writing a plugin for storing statistics on a database using URL query strings (as logins are not required).
I have worked out how to store information on the DB, but it just stores them all as new entries, I want to be able to find 1 with specific information, and if it exists update it, and if it doesn't, create it.

The WP dev stuff (wpdb mostly) don't seem to have anything I understand particularly well, so I cannot seem to use it, and I can't find any straight-forward way of checking if 2 values are "this".

My DB table is structured like so:
id - Int10 AUTO_INCREMENT
level int3 NOT NULL
moves int3 NOT NULL
count int6 NOT NULL

For instance, if I post level=12 and moves=8 to it, I want it to check to see if there is already an entry with that in, if there is, just increase the count by 1, and if it doesn't exist, create it with a count of 1.

I think this would have something to do with get_results or something like that, but it only seems to take 1 WHERE clause.

My posting code is below:

function stat_submit_function($atts, $content = null) {

	global $wp_query;
if (isset($wp_query->query_vars['level']))
{
if (isset($wp_query->query_vars['moves']))
{
if ($wp_query->query_vars['validate'] === "TH19wJxhjezyIr83KMMnW510Um4D74S0")
{
/*require_once('../../../wp-load.php');*/
global $wpdb;
$table_name = $wpdb->prefix . "ftbstatistics";
$level = $wp_query->query_vars['level'];
$moves = $wp_query->query_vars['moves'];

$wpdb->insert($table_name, array(
    'level' => $level,
    'moves' => $moves,
    'count' => '1')
);

echo "Successful Connection - Your Stats Have Been Saved!";
echo "<br/>";
echo "Level=" . $wp_query->query_vars['level'] . " - " . "Moves=" . $wp_query->query_vars['moves'];
}
}
}
}

themeply on "Detect hover over control label in customizer"

0
0

In the WordPress Customizer > Site Identity: there's a text field for 'Site Title' wrapped in a list item id li#customize-control-blogname

I want to detect whenever a user hovers over this element. I tried the following in theme-customizer.js to no avail:

$( "#customize-control-blogname" ).hover(function() {
    alert('hover!');
});

I'm guessing I need to use bind somehow?

I'm certain the JS file is loaded.

Thank you in advance.

guylancaster on "sessions and cookies"

0
0

This code dosen't set the cookie (It's not there when I look in google inspector)

session_start();
$psw=$_POST["psw"];
if (strlen($psw)>0)
{
	setcookie("thepsw", "12345", time()+3600, '/');
	$_SESSION["thepsw"]=$psw;
}
var_dump($_COOKIE);
var_dump($_SESSION);

It sets the session, but when I go to another wordpress screen, it has lost the session value too. I would like a solution for both if pos, please.

Viewing all 8245 articles
Browse latest View live




Latest Images