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

JeffSydor-BIPC on "Problem getting child theme directory to echo"

$
0
0

I am trying to get this to work across multiple pages using the same theme with minimal changes to the header.php file:

<?php
    if ( is_page( 'archives' ) ) {
        echo '<link type="text/css" rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/style-archives.css" />';
    }
    elseif ( is_page( 'sitemap' ) ) {
        echo '<link type="text/css" rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/style-sitemap.css" />';
    }
?>

However when I test the code each page that I'm referencing is showing the PHP string in the href instead of the directory:

<link type="text/css" rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/style-sitemap.css" />

It should read:

<link type="text/css" rel="stylesheet" href="http://website.com/wp-content/themes/childtheme/style-sitemap.css" />


Dudo on "Return multiple comment_meta keys"

$
0
0

I've this code

$args = array(
                'post_id' => $post_id,
                'meta_query' => array(
                                        'relation' => 'AND',
                                        array(
                                            'key' => 'review_title'
                                        ),
                                        array(
                                            'key' => 'review_rating',
                                        )
                                    ),
            );

$comments_query = new WP_Comment_Query;
$comments_array = $comments_query->query( $args );

It works fine, will work only if review_title AND review_rating exists. But it return only the second key, and I need to return both. How can I do that?

Hatul666 on "How to add an additional to every menu I create"

$
0
0

Hey guys, I have just learnt how to create a nav menu using wordpress functions: http://codex.wordpress.org/Navigation_Menus

My menu looks like this:

<ul class="menu"> <!-- First Menu -->
	<li> <a href="#"> Clients </a> </li>
	<li> <a href="#"> About Us </a> </li>
	<li class="contact"> Contact </li>
	<li class="hasImage"> <a href="*link to the homepage**"> <img src="http://xxx.com/wp-content/themes/twentyfifteen-child/images/logo.png" class="logo"> </a> </li>
</ul>

The last <li> tag contains an image. and shows up in all list items.
How do I add the image in the <li>

mickeybrouwer on "get_the_terms and get_term_by problems with showing categories and subcategories"

$
0
0

Hello everyone,

The following code displays category linked to subcategories. The problem is that only one subcategory is shown despite several are available.

How can I modify this code so more subcategories($val) are shown on the page?

add_filter("woocommerce_product_tabs", "custom_tabs");
function custom_tabs( $_original )
{
	global $post;

	$aTerms = get_the_terms($post->ID, "product_cat");

	$aUse = array();
	foreach( $aTerms as $oTerm )
	{
		if( $oTerm->parent > 0 )
		{
			$oParent = $aTerms[$oTerm->parent];
			if( empty($oParent) )
			{
				$oParent = get_term_by("id", $oTerm->parent, "product_cat");
			}
			// Original line
			$aUse[$oParent->name] = $oTerm->name;
		}

	}

	echo "<div class='specifications'>";
	foreach( $aUse as $cat => $val )
	{
		?>
			<div class="spec-wrapper">
				<div class="type">
					<?php echo $cat; ?>:
				</div>
				<div class="value">
					<?php echo $val; ?>
				</div>
			</div>
		<?php
	}
	echo "</div>";

	return $_original;
}

This is the page:
http://www.legrandcru.nl/product/soave-classico-azienda-agricola-fornaro-2013/

Serveertip is a category and Vis gestoofd is a subcategory, but there are more subcategories but they don't show up.

Alot of thanks in advance for your time, hope you can help me out.

Greetings,

Mickey

jackbomb on "Hide 3 recent posts from category"

$
0
0

Hi there,

I'm trying to hide the 3 most recent posts from a 'Featured' category from the main feed on the home page.
The Featured category already shows up on the slider, and I don't want them repeating (at least not the immediate ones).

I've tried Simply Exclude, but doesn't seem to work - may be clashing with something else.

So I'm really trying to find the solution from the codex, but can't nail it.

Any advice? Thanks in advance.

Dave Navarro, Jr. on "WP-CRON Execute at or after specific time"

$
0
0

How can I get a WP-CRON even to fire on or after 7am daily?

I tried the following:

wp_schedule_event( current_time('m-d-Y 07:00:00'), 'daily', 'nn_newsletter_event');

But it seams to use GMT and not local time as indicated in the codex.

I could put in 1:00:00 (since it's set up to run at noon), however it wouldn't take DST into account when it changes.

maxtex on "my blog site has been hyjacked by ISIS Cyber police"

$
0
0

I am unable to access my blog site (blog.bnsl.org). Site goes to a strange website apparently run by the "3xplr3 Cyber Army" Apparently someone didn't like a recent blog on Charlie Hebdo massacre. I've tried different computers with same result. Any thoughts on how to correct?

MattIzzy on "How to add icons to categories and list them on page?"

$
0
0

Hello, how can I assign an icon to each category in my website, and display the categories title and their icons inside a page? Using coding or plugins or both.


hostelfuessen on "website will be redirected to malicious link"

nicolasno on "how to sort by alpha in archive.php"

$
0
0

Alert newbie ;-)

I've created a archive to make a member list (with custom post type), but i want to sort post by alphabetic order.

i suppose that i've to make a query order by, but i'm just a newbie... ;-)

Could you help me ?

Thank you

This is the code of my page:

<?php get_header(); ?>

	<div class="content">

		<div class="page-title">

			<h4>

				<?php if ( is_day() ) : ?>
					<?php _e('Date', 'wilson'); ?><span class="name"><?php echo get_the_date(); ?></span>
				<?php elseif ( is_month() ) : ?>
					<?php _e('Month', 'wilson'); ?><span class="name"><?php echo get_the_date('F Y'); ?></span>
				<?php elseif ( is_year() ) : ?>
					<?php _e('Year', 'wilson'); ?><span class="name"><?php echo get_the_date('Y'); ?></span>
				<?php elseif ( is_category() ) : ?>
					<?php _e('Category', 'wilson'); ?><span class="name"><?php echo single_cat_title( '', false ); ?></span>
				<?php elseif ( is_tag() ) : ?>
					<?php _e('Tag', 'wilson'); ?><span class="name"><?php echo single_tag_title( '', false ); ?></span>
				<?php elseif ( is_author() ) : ?>
					<?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
					<?php _e('Author', 'wilson'); ?><span class="name"><?php echo ($curauth->display_name); ?></span>
				<?php else : ?>
					<?php _e( 'Les membres', 'wilson' ); ?>
				<?php endif; ?>

			</h4>

			<?php
				$tag_description = tag_description();
				if ( ! empty( $tag_description ) )
					echo apply_filters( 'tag_archive_meta', $tag_description );
			?>

		</div> <!-- /page-title -->

		<div class="posts">

			<?php if ( have_posts() ) : ?>

				<?php rewind_posts(); ?>

				<?php while ( have_posts() ) : the_post(); ?>

					<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

						<?php get_template_part( 'contentmembres', get_post_format() ); ?>

					</div> <!-- /post -->

				<?php endwhile; ?>

		</div> <!-- /posts -->

		<?php if ( $wp_query->max_num_pages > 1 ) : ?>

			<div class="archive-nav">

				<?php echo get_next_posts_link( __('Older<span> posts</span>', 'wilson')); ?>

				<?php echo get_previous_posts_link( __('Newer<span> posts</span>', 'wilson')); ?>

				<div class="clear"></div>

			</div> <!-- /post-nav archive-nav -->

		<?php endif; ?>

	<?php endif; ?>

	<?php get_footer(); ?>

dale3h on "Get Post ID from Body Class with JavaScript or jQuery"

$
0
0

I was working on a project that required knowing the post ID of the current post being viewed and I was unable to find a good answer on how to get that post ID using JavaScript.

I would love to think that this will work on all WordPress installs, but I cannot make that guarantee. However, I did test it on a few of the WordPress Showcase websites (Adobe, Sony, and SiriusXM Canada) and it worked like a charm. For this to work, your <body> tag MUST have the class "postid-###" (where ### is the ID).

I am posting 2 flavors of this, one for raw JavaScript and one for jQuery. For this, there is really no advantage of using jQuery.

JavaScript:
var post_id = parseInt( ( document.body.className.match( /(?:^|\s)postid-([0-9]+)(?:\s|$)/ ) || [ 0, 0 ] )[1] );

jQuery (1.6 or later):
var post_id = parseInt( ( jQuery( 'body' ).prop( 'class' ).match( /(?:^|\s)postid-([0-9]+)(?:\s|$)/ ) || [ 0, 0 ] )[1] );

jQuery (1.5.x or earlier):
var post_id = parseInt( ( jQuery( 'body' ).attr( 'class' ).match( /(?:^|\s)postid-([0-9]+)(?:\s|$)/ ) || [ 0, 0 ] )[1] );

If the post ID was able to be found, post_id will now contain it. If not, post_id will be 0.

If anyone has any improvements to be made to this, by all means, please do not hesitate!

jonradio on "Detect Search Engine Crawlers"

$
0
0

One of my plugins turns a regular WordPress Site into a private site. One of my users wants to allow Search Engine indexing of his Site that is blocked (with my plugin) from everyone who is not logged in.

I've found a few general articles on detecting Search Engine Crawlers, but wondered if there any specific WordPress functions or hooks that would help. Or even just anyone with advice on the subject.

Tennaki on "Notification count in menu bar?"

$
0
0

I'm curious if there's any way I could have the notification number that is on the admin bar moved to a page link on the menu bar on my website.

I'm trying to get my BuddyPress-enabled website to a point where our registered users do not need to see the admin bar, but having the notifications counter is something I'd like to keep.

malkah on "CSS help create background box"

$
0
0

Hi
Im trying to create a background in a shape of a box around a text. It needs to be aligned to the middle of the page in all resolutions. I added some CSS to create the background box:

.background-search h2 {background: none repeat scroll 0 0 #156593; border-radius: 5px;}

however there is too much space around the text that I cant get rid of.

you can see the text here "This line needs to be in a box in the middle of the page " i will appreciate any help

rajagopalpalani on "Custom Registration form and Login form in Multistep"

$
0
0

I have used below code for custom registration and custom login.

Registration works fine. But custom login works partially. Login credentials are passed but not loading the current user to the page.

Can anyone help me regarding this.

[Large code excerpt removed by moderator per forum rules. Please use Pastebin for all large code excerpts. It works better anyway.]


grimnebluna on "Multiple instances of infinite scroll"

$
0
0

Hi.

How do I do multiple columns with multiple instances of infinite scroll (like mashable.com)? I have three colums, the first one is $query1 = new WP_Query('post_type=post');, the second one is $query2 = new WP_Query('post_type=video');, the third one is $query3 = new WP_Query('post_type=pdf');

so the setting is rather simple. I can for example use jetpack infinite scrolling on the first column without any problems: with

$new_args = array(
    'posts_per_page'   => $args['posts_per_page'],
    'paged'   => $args['paged'],
    'orderby'          => 'date',
    'order'            => 'DESC',
    'post_type'        => 'post',
    'post_status'      => 'publish',
);

but how do i make multiple instances for post_type=video and =pdf? I googled the problem and found some posts on this subject, most are quite old. So I was wondering if there is by now a hack or something for jetpack, infinite-scroll plugin or something else out there?

RobotHero on "Media Library list?"

$
0
0

Is there a function or anything I can call to get a list of all media files in the library or search them based on some attribute?

jeremy2805 on "Set a posts URL to an archive page?"

$
0
0

Hi,

I have a custom post type where posts don't have individual pages. A link to the post should take you to the appropriate archive page.

It's been pretty easy to do in general, but the search function returns posts and I want them to link to the appropriate archive page.

Is there a recommended way to do it? I guess I can fiddle with the search template..?

Many thanks.

rosocoeh on "CCTM html code in textarea"

$
0
0

Hi

When I try and enter html in my CCTM text area it displays it as text, it does not render the html at all....

<strong>this is my text</strong>

Is there away around this I have tried all the filters,

Thanks.

R.

Tyler on "Place a logo/icon next to an image in a post"

$
0
0

Hello,

I want to place a small logo next to every image within a post (the logo could be above, below, left, right of the image, doesn't mater). I can detect images within a post (get their ids and links).

Is there a way to do this using php plugin? I don't know much about css.

Thanks
Best regards

Viewing all 8245 articles
Browse latest View live




Latest Images